Skip to content

Unify cc2flash CLI and build Windows executable for releases - #12

Merged
phryneas merged 3 commits into
mainfrom
unify-cli-and-release-exe
Sep 6, 2026
Merged

phryneas merged 3 commits into
mainfrom
unify-cli-and-release-exe

Conversation

@phryneas

@phryneas phryneas commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Consolidate both CLI tools into one installable root-level cc2flash package.
  • Expose devices, device-info, start-adb, install-adb-startup, backup, inspect-image, build-image, and restore with an offline --dry-run.
  • Rename config modes to serial-only and preserve-files; retain the explicit fewer-reads opt-out and persistent ADB startup.
  • Remove keep-config, output overwrite, standalone readback verification/self-test commands, and restore confirmation/readback bypasses. Move deterministic self-checks into the test suite.
  • Add platform-neutral workflow documentation, a complete CLI reference, separate Windows executable setup, and direct GitHub archive installation instructions for Python users.
  • Build and smoke-test the Windows console executable in CI.

Release behavior

Publishing a release manually in GitHub (including a prerelease) triggers a build from that release's commit. After tests and executable smoke checks pass, the workflow attaches cc2flash.exe and its SHA-256 checksum to the existing release.

The workflow does not create releases or tags. Saving a draft does not trigger it. Existing release assets are not overwritten. ADB remains a separate prerequisite.

Verification

  • 129 offline tests passed locally.
  • Linux and Windows CI passed on Python 3.10 and 3.12.
  • Windows executable build and out-of-source-tree smoke tests passed.
  • Root package wheel built and module invocation was checked from an isolated installation outside the source folder.
  • Both config modes generated full recovery images byte-identical to the original builder for the supplied bricked-camera dump.
  • No camera access or physical writes were performed for this refactor. No supplied dumps or generated firmware images were committed or uploaded.

Successful branch CI run

Copilot AI 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.

🟡 Changes recommended

Recovery bundles need atomic publication, and dry-run hardware-option rejection currently permits abbreviated options.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Consolidates camera recovery and maintenance into one installable cc2flash CLI, adds offline restore planning, and introduces Windows release executables.

Changes:

  • Unifies CLI commands, packaging, safety checks, and terminology.
  • Adds installation/CLI documentation and Windows executable workflows.
  • Expands offline tests and executable smoke testing.
File summaries
File Description
cc2flash/* Consolidates CLI, image, transport, display, and restore logic.
tests/* Updates and expands unified CLI regression coverage.
docs/* Adds installation and complete CLI references.
README.md Updates user workflows for the unified CLI.
hardware-recovery/* Updates recovery commands and terminology.
usb-maintenance/* Updates references, checksums, and removes nested packaging.
packaging/* Adds executable entry point and smoke test.
.github/workflows/* Adds cross-platform tests and release executable publishing.
pyproject.toml Defines root-level package metadata and dependencies.
.gitignore Ignores generated PyInstaller specifications.
Review details

Suppressed comments (2)

cc2flash/cli.py:513

  • argparse accepts unique long-option prefixes by default, but this guard compares only exact spellings. For example, restore ... --dry-run --bootloader-t 5 is parsed as --bootloader-timeout and then silently accepted even though the documented contract says hardware options are rejected for an offline plan. Disable option abbreviation on the restore parser (and add the abbreviated form to this regression test) so an explicitly supplied hardware setting cannot be ignored.
    cc2flash/image.py:1585
  • The output directory is made visible before any bundle member is written. An I/O failure during the sequence below can therefore leave a partial bundle (potentially including a truncated recovery image), and because existing directories are now always refused, a retry cannot repair it. Build in a sibling temporary directory and atomically rename it into place only after all members and checksums have been written; clean up the temporary directory on failure.
  • Files reviewed: 37/38 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread hardware-recovery/TEST_RESULTS.md Resolved
Comment thread usb-maintenance/PROJECT-STATUS.md Resolved
@phryneas

phryneas commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

restore should accept the same options with --dry-run as without, just not require those that are not necessay for the offline functionality. Forbidding them has no benefit and worsens user experience.

Comment thread .github/workflows/release.yml Resolved
Comment thread docs/CLI.md Resolved
Comment thread docs/CLI.md Resolved
Comment thread docs/CLI.md Resolved
Comment thread docs/INSTALLATION.md Resolved
Comment thread docs/INSTALLATION.md Resolved
Comment thread docs/INSTALLATION.md Resolved
Comment thread docs/INSTALLATION.md Resolved
Comment thread docs/INSTALLATION.md Resolved
Comment thread hardware-recovery/CLI_REFERENCE.md Resolved
Comment thread hardware-recovery/TEST_RESULTS.md Resolved
Comment thread usb-maintenance/REFERENCE.md Resolved
Comment thread usb-maintenance/SHA256SUMS Resolved
Comment thread README.md Resolved

phryneas commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed all review feedback in 3308e12 and replied to the inline threads.

  • restore --dry-run accepts normal restore options, including hardware options, without accessing a device. This follows the maintainer's requested behavior and supersedes Copilot's suggestion to tighten the removed rejection check.
  • Persistent ADB installation now works while temporary ADB is online, retaining validation and explicit installation consent.
  • Recovery bundles are built in a sibling staging directory and published atomically only after every member is complete. Exclusive publication preserves existing destinations, including ones created concurrently; failures clean up staging and allow retry.
  • Applied the documentation edits, removed the redundant CLI reference and source checksum file, and restored both dated verification reports exactly from the PR base. The historical terminology is intentionally retained per the maintainer's request.
  • Pinned all actions to current release hashes and added a zizmor audit of every workflow. Release creation remains manual.

Validation: 135 offline tests pass on Linux, Windows and macOS with Python 3.10/3.12; the Windows executable build and frozen smoke tests pass; zizmor passes. Locally, a supplied dump also passed a simulated final-file write failure followed by a clean, complete rebuild. No camera was accessed or firmware uploaded.

CI: https://github.com/phryneas/cc2_camera_fix/actions/runs/34061804250

Comment thread docs/CLI.md Resolved
Comment thread docs/CLI.md Resolved

Copilot AI 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.

🔵 Needs a closer look

The broad migration affects destructive hardware-recovery workflows and release distribution, warranting final human validation despite strong offline coverage.

Review details
  • Files reviewed: 38/39 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@phryneas
phryneas merged commit cec93df into main Sep 6, 2026
14 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