Skip to content

feat: add --hide-cached#2316

Open
Adjective-Object wants to merge 1 commit intomoonrepo:masterfrom
Adjective-Object:adjective-object/hide-cached-flag
Open

feat: add --hide-cached#2316
Adjective-Object wants to merge 1 commit intomoonrepo:masterfrom
Adjective-Object:adjective-object/hide-cached-flag

Conversation

@Adjective-Object
Copy link
Contributor

Adds --hide-cached to the exec family of commands. This is used to configure the MoonReporter's behaviour for a given command run.

At present the only way to configure task reporting is with the individual task's reporting settings. This change adds a new mechanism to configure the reporter behaviour from command line flags.

A "clean" separation of concerns might complicate this by making a separate MoonTaskReporter that is aware of tasks, and initialize it in each of the exec-family commands. However, because the MoonReporter is aware of tasks and configured before subcommand execution, we need to read the CLI commands outside of the individual subcommands in order to initialize it before descending into subcommand execution.

I'm not 100% happy with this design, but I tried plumbing overrides through TaskReportItem, and I didn't like that design because it conflated transient, global CLI config with persistent config from individual task configs. I think this is a reasonable compromise that doesn't involve rewriting the MoonReporter to be more "pure" and harder to maintain.

Closes #1930

@Adjective-Object
Copy link
Contributor Author

Adjective-Object commented Jan 21, 2026

In my perfect world there would be a way to configure this at the repo level as a default setting as well, but I couldn't figure out if that matches with any of the existing config systems.

Is there a decent place to discuss these things out of band? I keep seeing people mention a Discord in other issues/PRs but can't find it online anywhere 😅

Adds --hide-cached to the `exec` family of commands. This is used to configure the MoonReporter's behaviour for a given command run.

At present the only way to configure task reporting is with the individual task's reporting settings. This change adds a new mechanism to configure the reporter behaviour from command line flags.

A "clean" separation of concerns might complicate this by making a separate MoonTaskReporter that is aware of tasks, and initialize it in each of the exec-family commands. However, because the MoonReporter is aware of tasks and configured before subcommand execution, we need to read the CLI commands outside of the individual subcommands in order to initialize it before descending into subcommand execution.

I'm not 100% happy with this design, but I tried plumbing overrides through TaskReportItem, and I didn't like that design because it conflated transient, global CLI config with persistent config from individual task configs. I think this is a reasonable compromise that doesn't involve rewriting the MoonReporter to be more "pure" and harder to maintain.

Closes moonrepo#1930
@Adjective-Object Adjective-Object force-pushed the adjective-object/hide-cached-flag branch from 84c1d73 to b20ffa4 Compare January 21, 2026 16:53
@milesj
Copy link
Collaborator

milesj commented Feb 26, 2026

@Adjective-Object Sorry for the late reply, wanted to get v2 out.

I've though about this before as well, and like you've seen, it's kind of awkward to get the settings into the right code paths.

This may make more sense as a config setting so that users don't always have to pass the arg. Maybe pipeline.hideCachedTaskOutput or something?

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Provide an option for moon run to hide output from cached tasks

2 participants