feat: add sync command - #1
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces the
ingen synccommand 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
synccommand automatically fetches asset digests from the GitHub Releases API and injects them into the local manifest.jsonc-parserto surgically update thechecksumfields to ensure minimal diff.GITHUB_TOKENenvironment variable to bypass rate limits and allow syncing from private repositories.Refactors
resolveManifest()toreconstructManifest()and extracted string substitutions into a standaloneresolveManifest()function. This allows thesynccommand to reuseresolveManifest()try/catchblocks andZodErrorformatting out of individual commands and into theindex.tsrouter. As a Zod errors thrown from the generate command and from the newsynccommand (and future commands) will be handled centrally.