Skip to content

Refactor parser into modular files, add ComfyUI support, and add Windows release workflow#1

Merged
KidiXDev merged 7 commits intomainfrom
copilot/refactor-main-logic-and-add-image-support
Mar 12, 2026
Merged

Refactor parser into modular files, add ComfyUI support, and add Windows release workflow#1
KidiXDev merged 7 commits intomainfrom
copilot/refactor-main-logic-and-add-image-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 12, 2026

The parsing logic lived in a single file with excessive debug logging and no support for ComfyUI images. This PR splits the parser, adds ComfyUI detection and extraction, updates the UI and README accordingly, and adds a GitHub Actions workflow to automatically tag and release Windows builds when the package version changes.

Parser refactor

Replaced monolithic utils/parser.ts with focused modules:

  • utils/types.ts — shared ExifTag and ImageParameters interfaces
  • utils/a1111-parser.ts — A1111/AUTOMATIC1111 parser; removed debug console.log calls, simplified flow via parseParameterBlock
  • utils/comfyui-parser.ts — new ComfyUI node-graph JSON parser (see below)
  • utils/parser.ts — thin re-export facade for backward compatibility

ComfyUI support

ComfyUI embeds a node-graph JSON in the PNG prompt text chunk. The new parser:

  1. Detects the format via isComfyUIWorkflow() — checks for class_type keys in the JSON
  2. Traverses the graph to extract parameters:
// KSampler/KSamplerAdvanced → steps, cfg, sampler, scheduler, seed
// positive/negative refs    → prompts
// model ref                 → checkpoint name
// latent_image ref          → resolution

imageProcessing.ts now builds a flat Record<string, ExifTag> from ExifReader's flat Tags and Sharp's PNG text chunks, runs format detection, and attaches parserType: 'a1111' | 'comfyui' | 'unknown' to every result.

UI & types

  • Subtitle updated to reflect both supported tools
  • MetadataViewer renders a pill badge ("Stable Diffusion WebUI (A1111)" / "ComfyUI") next to image info
  • preload/index.d.ts and env.d.ts updated with parserType; fixed pre-existing openExternal type mismatch

README

Supported AI Tools section replaced with a status table; project structure updated to reflect new parser layout.

CI: Automated Windows release workflow

Added .github/workflows/release.yml that runs on every push to main (and supports manual dispatch):

  1. Version check (ubuntu-latest): reads version from package.json and uses git ls-remote to check whether the tag v{version} already exists. If it does, the build job is skipped.
  2. Build & release (windows-latest, only when tag is new):
    • Installs dependencies with yarn install --frozen-lockfile
    • Builds the Windows NSIS installer via yarn build:win (produces dist/stable-parser-{version}-setup.exe)
    • Creates the git tag, a GitHub Release with auto-generated release notes, and uploads the .exe as a release asset via softprops/action-gh-release@v2

To publish a new release, bump "version" in package.json and push to main.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: KidiXDev <100352770+KidiXDev@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor main logic for better readability and add image support Refactor parser into modular files and add ComfyUI support Mar 12, 2026
@KidiXDev KidiXDev marked this pull request as ready for review March 12, 2026 06:55
@KidiXDev
Copy link
Copy Markdown
Owner

@copilot add github action workflow for auto create tag if not exist based on package version and release for windows

Co-authored-by: KidiXDev <100352770+KidiXDev@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 12, 2026

@copilot add github action workflow for auto create tag if not exist based on package version and release for windows

Added in commit 1b4beab.github/workflows/release.yml.

How it works:

  1. Trigger: runs on every push to main (and can be triggered manually via workflow_dispatch).
  2. Version check (check-version job, ubuntu-latest): reads version from package.json, then uses git ls-remote to check whether the tag v{version} already exists on the remote. If it does, the second job is skipped entirely.
  3. Build & release (release-windows job, windows-latest): only runs when the tag doesn't exist yet:
    • Installs dependencies with yarn install --frozen-lockfile
    • Builds the Windows installer via yarn build:win (produces dist/stable-parser-{version}-setup.exe per electron-builder.yml)
    • Uses softprops/action-gh-release@v2 to create the git tag, the GitHub Release, and upload the .exe as a release asset with auto-generated release notes

To release a new version simply bump "version" in package.json and push to main — the workflow handles the rest.

Copilot AI changed the title Refactor parser into modular files and add ComfyUI support Refactor parser into modular files, add ComfyUI support, and add Windows release workflow Mar 12, 2026
@KidiXDev KidiXDev merged commit d135275 into main Mar 12, 2026
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