Skip to content

Style human-readable install progress - #883

Merged
jviotti merged 1 commit into
sourcemeta:mainfrom
HarshPopat23:style-install-progress
Sep 24, 2026
Merged

jviotti merged 1 commit into
sourcemeta:mainfrom
HarshPopat23:style-install-progress

Conversation

@HarshPopat23

@HarshPopat23 HarshPopat23 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Style the human-readable progress labels emitted by jsonschema install.
Progress labels use bold cyan, successful states use bold green, recoverable or automatically repaired states use bold yellow, and frozen-mode failures use bold red. Only the fixed-width label is styled; paths, URIs and separators remain plain. The existing 14-character alignment is calculated from the unstyled label, so ANSI escape sequences do not affect column alignment.

Compatibility

  • Redirected --color auto output remains plain.
  • --color never remains plain.
  • install --json remains ANSI-free and byte-for-byte compatible.
  • Debug events, lock-file behavior, frozen-mode behavior and exit codes are unchanged.

Tests

Added CLI coverage for forced-color installation, up-to-date dependencies, adding dependencies, repaired and frozen orphan states, frozen failures, explicit no-color behavior and JSON output.

image

Review in cubic

@augmentcode

augmentcode Bot commented Sep 24, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR adds semantic ANSI styling to human-readable jsonschema install progress output.
Changes:

  • Introduces reusable progress, success, warning, and failure label styles in command_install.cc.
  • Paints only the fixed-width status label, preserving the existing alignment of paths, URIs, and separators.
  • Keeps verbose bundle/write/verify output plain when JSON mode is active.
  • Applies colors through the stderr terminal stream, honoring the global --color policy.
Technical Notes:
  • Adds CLI coverage for forced color, no-color, JSON, dependency addition, up-to-date, repair, and frozen failure paths.
  • Existing plain output behavior continues to exercise the auto-color/redirection path.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 11 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/command_install.cc">

<violation number="1" location="src/command_install.cc:247">
P2: Frozen mismatches are failures, but this label remains yellow. Select `FAILURE_STYLE` when `orphaned_behavior == OrphanedBehavior::Error` and keep `WARNING_STYLE` for automatically repaired mismatches.</violation>
</file>

<file name="test/install/fail_frozen_mismatch_color_always.clitest">

<violation number="1" location="test/install/fail_frozen_mismatch_color_always.clitest:41">
P3: These new frozen failure tests cover only human-readable output, leaving JSON failure events unverified. Add a matching `--json --color always` run and compare its structured events for all three `fail_frozen_*_color_always` cases.

(Based on your team's feedback about JSON variants for failure tests.) [8987a25a-4f41-4a67-914e-ada0d55918a7]</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/command_install.cc
Comment on lines +247 to 248
std::cerr << padded_label("Mismatched", WARNING_STYLE)
<< event.path.generic_string() << "\n";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Frozen mismatches are failures, but this label remains yellow. Select FAILURE_STYLE when orphaned_behavior == OrphanedBehavior::Error and keep WARNING_STYLE for automatically repaired mismatches.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/command_install.cc, line 247:

<comment>Frozen mismatches are failures, but this label remains yellow. Select `FAILURE_STYLE` when `orphaned_behavior == OrphanedBehavior::Error` and keep `WARNING_STYLE` for automatically repaired mismatches.</comment>

<file context>
@@ -221,7 +244,7 @@ auto make_on_event(const sourcemeta::core::Options &options,
                         event.path.generic_string());
             } else {
-              std::cerr << padded_label("Mismatched")
+              std::cerr << padded_label("Mismatched", WARNING_STYLE)
                         << event.path.generic_string() << "\n";
             }
</file context>
Suggested change
std::cerr << padded_label("Mismatched", WARNING_STYLE)
<< event.path.generic_string() << "\n";
std::cerr << padded_label(
"Mismatched", orphaned_behavior == OrphanedBehavior::Error
? FAILURE_STYLE
: WARNING_STYLE)
<< event.path.generic_string() << "\n";

COPY project/jsonschema.lock.json TO lock_before.json

// Validation failure with forced color
RUN install --frozen --color always STDIN /dev/null IN project INTO result_1.txt EXPECTING 2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: These new frozen failure tests cover only human-readable output, leaving JSON failure events unverified. Add a matching --json --color always run and compare its structured events for all three fail_frozen_*_color_always cases.

(Based on your team's feedback about JSON variants for failure tests.) [8987a25a-4f41-4a67-914e-ada0d55918a7]

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At test/install/fail_frozen_mismatch_color_always.clitest, line 41:

<comment>These new frozen failure tests cover only human-readable output, leaving JSON failure events unverified. Add a matching `--json --color always` run and compare its structured events for all three `fail_frozen_*_color_always` cases.

(Based on your team's feedback about JSON variants for failure tests.) [8987a25a-4f41-4a67-914e-ada0d55918a7]</comment>

<file context>
@@ -0,0 +1,56 @@
+COPY project/jsonschema.lock.json TO lock_before.json
+
+// Validation failure with forced color
+RUN install --frozen --color always STDIN /dev/null IN project INTO result_1.txt EXPECTING 2
+
+REPLACE $CWD_URI WITH '[CWD_URI]' IN result_1.txt
</file context>

Signed-off-by: HarshPopat23 <musichk61@gmail.com>

@jviotti jviotti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@jviotti
jviotti merged commit 3eecbab into sourcemeta:main Sep 24, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants