Skip to content

[Request] multi-level tasklog #336

@yannbf

Description

@yannbf

Is your feature request related to a problem? Please describe.
We are currently exploring clack for Storybook's CLI. When upgrading multiple Storybook projects (e.g. in a monorepo), we loop through each project and run migrations. Each migration will execute a set of things which might take time. This use case makes us want to use clack's taskLog because of its convenient collapsing feature, although it doesn't match with our expectations at the moment as our use case is a bit more complex.

Describe the solution you'd like
Ideally we would be able to use a taskLog per project, then an inner taskLog per migration:

Starts with a single taskLog per project:

◇ Upgrading project 1/4 // beginning of a taskLog
|   detecting migrations // taskLog.message
|

Then it finds multiple migrations from one of the projects, starting an inner task log while the outer one is still open:

◇ Upgrading project 1/4 // beginning of a taskLog
|   detecting migrations // taskLog.message
| ◇  migration FOO detected, running... // beginning of inner taskLog
|      migration step 1 // innerTaskLog.message
|      migration step 2 // innerTaskLog.message
|

Then the inner task logs are iterated, the previous one ends its session, the next one begins, while the outer task log is still open:

◇ Upgrading project 1/4 // beginning of a taskLog
|   detecting migrations // taskLog.message
| ⬩ migration FOO executed // innerTaskLog.success
| ◇  migration BAR detected, running... // beginning of another inner taskLog
|      migration step 1 // anotherInnerTaskLog.message
|      migration step 2 // anotherInnerTaskLog.message
|

Then upon all inner task logs succeed:

◇ Upgrading project 1/4 // beginning of a taskLog
|   detecting migrations // taskLog.message
| ⬩  migration FOO executed
| ⬩  migration BAR executed // anotherInnerTaskLog.success
|

The outer task log is then succeeded, and the iteration continues so another loop of outer + inner task logs are shown:

⬩ Project 1/4 upgraded
◇ Upgrading project 2/4 // beginning of a taskLog
|   detecting migrations // taskLog.message
| ◇  migration FOO detected, running... // beginning of inner taskLog
|      migration step 1 // innerTaskLog.message
|      migration step 2 // innerTaskLog.message
|

Ideally even making it possible to prompt during a taskLog session, but I know it's hard to keep track of the buffer from all of that. Perhaps this would need a new concept? If there was a way for us to at least manipulate (get/set) the buffer of taskLogs maybe we could try some workaround on our end. Currently, multiple taskLogs inside of each other end up in non-ideal clearing of the terminal messages, as the outer task log doesn't account for the buffer generated by the inner task logs (or any other logs from clack, either prompts or normal logs)

Describe alternatives you've considered
We tried patching clack but it doesn't seem like the best idea, ideally we could collaborate in making this a great feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions