Skip to content

Remove click UI from core (#117)#166

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1784154380-remove-click-from-core
Open

Remove click UI from core (#117)#166
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1784154380-remove-click-from-core

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Fixes #117. Moves all click UI out of the core rose-py library into the rose-cli frontend, so the core no longer drives $EDITOR or terminal prompts. Per the issue discussion, click stays imported in rose-py — but only for styling (click.style) in the rule parser.

Editor flows (releases / collages / playlists). Each edit_*_in_editor / edit_release function is split into a pure serialize_* (produce the text to edit) and upsert_* (apply the edited text). The CLI owns click.edit and cancellation:

# core (rose-py) — no click
def serialize_collage(c, name) -> str: ...
def upsert_collage(c, name, edited_descriptions: str) -> None: ...

# cli (rose-cli)
def edit(ctx, collage):
    edited = click.edit(serialize_collage(ctx.config, collage))
    if edited is None:            # editor aborted
        return
    upsert_collage(ctx.config, collage, edited)

Release edits keep the existing failed-edit resume-file semantics: upsert_release_metadata still writes failed-release-edit.<id>.toml on failure and deletes it on success, and serialize_release_metadata(..., resume_file=...) reads from it. The CLI skips the write when the TOML is unchanged (and not resuming), matching the old behavior.

Rules engine. execute_metadata_actions no longer calls click.echo/secho/confirm/prompt. It builds a MetadataMutationPlan (the computed-but-unwritten changes, with .describe(c) and .num_changes) and delegates presentation + confirmation to two callbacks:

ChangesPreviewer = Callable[[MetadataMutationPlan, Config], None]
ChangesConfirmer = Callable[[int], bool]  # returns whether to proceed

The colored diff and the "enter N to confirm" logic (formerly enter_number_to_confirm_above_count) now live in the CLI's _preview_changes / _confirm_changes, threaded through run_actions_on_release, run_actions_on_track, execute_metadata_rule, and execute_stored_metadata_rules.

Rule parser. RuleSyntaxError exposes both forms of its message:

str(exc)          # plain, no ANSI styling
exc.str_click     # same message, click-styled (red caret, bold feedback)

The CLI's top-level error handler (__main__.py) prints str_click for RuleSyntaxError and str(e) otherwise.

Testing

mypy ., ruff format --check, and ruff check pass on the changed files. pytest passes except the 4 pre-existing VFS mount tests that require FUSE (fuse: device not found in this sandbox) — unrelated to this change.

Link to Devin session: https://app.devin.ai/sessions/708f229d38bb44a085985640dbddb67c

Move $EDITOR/click.edit interaction and rules-engine preview/confirmation
prompts out of rose-py into rose-cli:

- releases/collages/playlists: replace the editor functions with
  serialize_*/upsert_* core functions; the CLI owns click.edit and
  cancellation. Release resume-file behavior is preserved in the core
  upsert.
- rules engine: execute_metadata_* build a MetadataMutationPlan and
  delegate presentation/confirmation to preview/confirm callbacks
  supplied by the CLI.
- rule_parser: RuleSyntaxError keeps a plain str() message and adds a
  click-styled str_click property (click is imported only for styling).
- update exports, tests, and the CLI top-level error handler.
@azuline azuline self-assigned this Jul 15, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

Remove click from core

1 participant