patchbayUiCaptureCommandDescriptor top-level property

PatchbayCommandDescriptor patchbayUiCaptureCommandDescriptor
final

Implementation

final patchbayUiCaptureCommandDescriptor = _ui(
  'ui.capture',
  'Capture a bounded Flutter repaint boundary as a PNG blob.',
  mode: PatchbayCommandMode.readOnly,
  effect: PatchbaySideEffect.none,
  parameters: <PatchbayParameterDescriptor>[
    _p('targetId', PatchbayParameterType.string),
    _p('generation', PatchbayParameterType.integer),
    _p('pixelRatio', PatchbayParameterType.number, defaultValue: 1),
    _timeout,
    // 随 !54 进入 main:命令受理后再观察这么多 Flutter 帧才取证,范围 1..120。
    _p('afterFrames', PatchbayParameterType.integer, defaultValue: 1),
  ],
  cliSyntax: const <PatchbayCliSyntax>[
    PatchbayCliSyntax(
      id: 'captureRoot',
      path: <String>['capture', 'root'],
      summary: 'Capture the Flutter root repaint boundary.',
      usageSuffix: '--output <path>',
      optionParameters: <String, String>{
        'pixelRatio': 'pixel-ratio',
        'timeoutMs': 'timeout-ms',
        'afterFrames': 'after-frames',
      },
      positiveParameters: <String>{'timeoutMs', 'afterFrames'},
      artifactDisposition: PatchbayCliArtifactDisposition.payloadBlob,
    ),
    PatchbayCliSyntax(
      id: 'captureTarget',
      path: <String>['capture', 'target'],
      summary: 'Capture a registered Flutter UI target.',
      usageSuffix: '<target-id> <generation> --output <path>',
      positionalParameters: <String>['targetId', 'generation'],
      optionParameters: <String, String>{
        'pixelRatio': 'pixel-ratio',
        'timeoutMs': 'timeout-ms',
        'afterFrames': 'after-frames',
      },
      positiveParameters: <String>{'timeoutMs', 'afterFrames'},
      nonNegativeParameters: <String>{'generation'},
      artifactDisposition: PatchbayCliArtifactDisposition.payloadBlob,
    ),
  ],
  // PB-050-40: both spellings download the same host blob metadata, so the
  // artifact is a property of the command rather than of the spelling and
  // moves to the descriptor. `cliSyntax.artifactDisposition` stays as the
  // build-time fact that decides which options the CLI grants before it has a
  // catalog to read.
  outputProjection: const PatchbayOutputProjection(
    artifact: PatchbayOutputArtifactProjection.payloadBlob(),
  ),
);