Skip to content

Add Markdown output support to brief inspect #180

Description

@abhinavgautam01

Summary

brief inspect supports JSON and human-readable output but does not support Markdown. This differs from the primary scan and the other reporting commands, which support --markdown for agent and CI-oriented output.

Markdown is also lost when an artifact passed to the primary command is automatically routed to inspect.

Current behavior

Explicit inspection rejects the flag:

brief inspect --markdown dist/package.whl
flag provided but not defined: -markdown

Automatic inspection accepts the primary command's flag but does not carry it into cmdInspect:

brief --markdown dist/package.whl

When stdout is not a terminal, this produces JSON rather than Markdown.

Root cause

  • cmdInspect defines only --json and --human.
  • The report package provides ArtifactJSON and ArtifactHuman, but no ArtifactMarkdown.
  • inspectAutoArgs accepts and forwards only the JSON and human flags.

Expected behavior

Both forms should produce equivalent Markdown artifact reports:

brief inspect --markdown dist/package.whl
brief --markdown dist/package.whl

Proposed implementation

  • Add a --markdown flag to cmdInspect.
  • Implement report.ArtifactMarkdown(w io.Writer, art *brief.Artifact).
  • Pass the Markdown flag through inspectAutoArgs when auto-routing from the primary command.
  • Preserve the existing precedence in which Markdown wins when multiple output flags are supplied.

The Markdown report should include:

  • Artifact path, container format, SHA-256, archive entry count, native object count and duration.
  • A section for each native object with path, format, architecture, SOName, producers, required dynamic libraries, Go build information and static-library hints.
  • Proper Markdown escaping for artifact paths and all metadata originating from inspected files.

Suggested tests

  • Unit-test ArtifactMarkdown with an archive containing multiple native objects.
  • Cover empty optional fields and an artifact with no native objects.
  • Verify Markdown escaping for pipes, newlines and other table-sensitive content.
  • Verify brief inspect --markdown artifact selects Markdown output.
  • Verify brief --markdown artifact preserves Markdown through automatic inspection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions