Skip to content

feat: add sync command - #1

Merged
hethon merged 5 commits into
masterfrom
feat/ingen-sync
Aug 6, 2026
Merged

feat: add sync command#1
hethon merged 5 commits into
masterfrom
feat/ingen-sync

Conversation

@hethon

@hethon hethon commented Aug 6, 2026

Copy link
Copy Markdown
Owner

This PR introduces the ingen sync command to eliminate the tedious process of manually copy-pasting checksums into the manifest. It also includes several architectural refactors to the CLI foundation to support this new command cleanly.

Key Features

  • The sync command automatically fetches asset digests from the GitHub Releases API and injects them into the local manifest.
    • Uses jsonc-parser to surgically update the checksum fields to ensure minimal diff.
    • Respects the GITHUB_TOKEN environment variable to bypass rate limits and allow syncing from private repositories.

Refactors

  • Renamed the older resolveManifest() to reconstructManifest() and extracted string substitutions into a standalone resolveManifest() function. This allows the sync command to reuse resolveManifest()
  • Moved try/catch blocks and ZodError formatting out of individual commands and into the index.ts router. As a Zod errors thrown from the generate command and from the new sync command (and future commands) will be handled centrally.

hethon added 5 commits August 6, 2026 04:17
…struction

Extracted the placeholder substitution logic (e.g., resolving `{app_version}`) into a dedicated `resolveManifest` function that mutates the manifest in-place. The original context-building function was appropriately renamed to `reconstructContext`.
Added `ingen sync <manifest>` to fetch release asset digests from the GitHub API and automatically inject them into the manifest.

It uses `jsonc-parser` to edit the file in-place so custom formatting and comments aren't destroyed. Also added `GITHUB_TOKEN` support to handle rate limits and private repos.
Restored the `.transform()` logic directly inside the Zod schema for `archive.checksum`. Extracting it didn't provide enough value and made `manifest_to_context.ts` unnecessarily verbose.

Updated `sync.ts` to correctly compare against `archive.checksum?.value` since the parsed manifest now returns the transformed object again.
@hethon
hethon merged commit 666e857 into master Aug 6, 2026
1 check 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.

1 participant