feat(workflows): align workflow CLI with extension command surface
Fixes #2342
Root cause
The workflow CLI grew after the extension CLI and never picked up the full command surface. workflow add only accepted catalog IDs, URLs, and plain file paths, and there was no way to update an installed workflow, filter search by author, or disable a workflow without removing it.
Change
Mirrors the extension/preset commands, using the same flag names and behavior:
workflow add --dev <path>installs from a local directory or YAML file for development.workflow add <id> --from <url>installs from an explicit URL, requires default-deny confirmation for the untrusted source, and rejects a downloaded workflow whose ID does not match.workflow search --author <name>filters catalog results by author using a case-insensitive exact match.workflow update [id]updates catalog-installed workflows when a newer version exists, with a confirmation prompt. Local and URL installs are skipped with a hint to re-add.workflow enable/disable <id>toggles the registry entry.workflow runandresumeenforce the current enabled state, whileworkflow listmarks disabled entries.
set-priority is omitted because workflows have no priority concept, and search --verified is omitted because the catalog has no verification data, per the issue discussion.
Catalog installation and update now share _install_workflow_from_catalog. The shared path performs bounded streaming downloads, validates redirects, stages and atomically swaps workflow files, rolls back workflow and registry state on validation or serialization failures, preserves existing registry permissions and ownership where possible, and revalidates the installed source/version under the install lock before an update commits.
Testing
Regression coverage includes the CLI alignment commands plus explicit URL confirmation, bounded/redirect-safe downloads, staged replacement and rollback failures, registry serialization rollback, file mode/ownership preservation, concurrent update revalidation, disabled workflow run/resume ownership and symlink handling, and bundle-removal failure reporting.
Full suite: 4078 passed, 110 skipped. ruff check clean.
Addressed the remaining review findings in 3763e6f, 86de599, fb64ddd, 49f6fb6, and 812050a: workflow errors are escaped, registry writes are atomic and rollback-safe, and add/update/remove failure paths now preserve registry/filesystem consistency for fresh installs and reinstalls. Full suite: 3971 passed, 110 skipped. Posted on behalf of @marcelsafin by GitHub Copilot (model: GPT-5.6 Sol). @copilot review
Fixed the latest review findings in 6a127b3, 12d985b, and ce3e0ab: workflow ownership checks are lexical and reject symlinked owning storage, registry read failures now fail closed before side effects, local-copy reinstalls roll back safely, bundled update messaging is accurate, and bundle removal converts workflow-registry failures into clean errors. Full suite: 3979 passed, 110 skipped. Posted on behalf of @marcelsafin by GitHub Copilot (model: GPT-5.6 Sol). @copilot review
Addressed all 8 review findings in 6b593e3: registry loading now fails closed on unsafe symlinks; install rollback/backup paths preserve prior state and handle read failures cleanly; bundle-removal state is accurate; Rich dynamics are escaped. Full suite: 3986 passed, 110 skipped; changed files pass ruff. Posted on behalf of @marcelsafin by GitHub Copilot (model: GPT-5.6 Sol). @copilot review
Addressed the 3 latest findings plus download-cleanup follow-up in db45f6c and b8269c8: BundlerError now reports partial removal accurately, both workflow download paths share a streamed 5 MiB cap, failed --from downloads remove their temp file, and tests assert the actual cap path. Full suite: 3994 passed, 110 skipped; changed files pass ruff. Posted on behalf of @marcelsafin by GitHub Copilot (model: GPT-5.6 Sol). @copilot review
Addressed all 5 latest findings plus transaction-cleanup follow-ups in 00465c3, 7c6bc90, and 915caf8: workflow files/directories now use atomic staging and guarded rollback, registry saves preserve existing mode, successful reinstalls discard backups, and failed staging leaves no workflow directory. Full suite: 4004 passed, 110 skipped; changed files pass ruff. Posted on behalf of @marcelsafin by GitHub Copilot (model: GPT-5.6 Sol). @copilot review
Addressed all 9 latest findings plus the moved-project resume follow-up in 792450e, 800b962, 616f727, and 4f24735: installed ownership now handles nested/symlink paths, disabled state is enforced on resume with move-safe run metadata, post-commit cleanup and update rollback are coherent, POSIX mode tests skip Windows, and bundle failure wording is conservative. Full suite: 4014 passed, 110 skipped; changed files pass ruff. Posted on behalf of @marcelsafin by GitHub Copilot (model: GPT-5.6 Sol). @copilot review
Please address Copilot feedback, fix test & lint errors and resolve conflicts
@copilot review
Please address Copilot feedback and resolve conflicts
@copilot review
Addressed the requested Copilot feedback in e736273; the current-head Copilot review generated no new comments. CI is waiting for maintainer approval.
Thank you!