Repository navigation
imagekit: maskable-safe icons + commit missing generate command - #18
Merged
Merged
Conversation
Source art that bleeds to the canvas edges gets clipped by OS icon masks (rounded square, circle) when used for maskable PWA/Android icons or the iOS apple-touch-icon, and shows transparency as stray white/black. With --bg set, `imagekit web` now trims, resizes content into the safe-zone fraction of the canvas, flattens onto the opaque background, and strips the alpha channel for every square icon output. Behavior without --bg is unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds `imagekit generate` (OpenRouter image models) plus its README docs and the @openrouter/sdk dependency. This was already wired into index.ts but the command file itself hadn't been committed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues include stale CLI version reporting, HTTPS image URL handling, and invalid safe-zone validation.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds maskable-safe opaque web icons and restores the OpenRouter-based generate command.
Changes:
- Adds
--bgand--safe-zoneicon processing. - Adds generation support, documentation, tests, and dependencies.
- Updates package metadata and lockfile.
File summaries
| File | Summary |
|---|---|
apps/imagekit/src/test-support.ts |
Image inspection helpers |
apps/imagekit/src/index.ts |
CLI options and command registration |
apps/imagekit/src/commands/web.ts |
Background flattening and safe-zone padding |
apps/imagekit/src/commands/web.test.ts |
Web icon tests |
apps/imagekit/src/commands/generate.ts |
OpenRouter image generation |
apps/imagekit/README.md |
Command documentation |
apps/imagekit/package.json |
Version and dependency updates |
apps/imagekit/bun.lock |
Locked dependency updates |
Review details
Suppressed comments (1)
apps/imagekit/src/commands/generate.ts:77
- This adds a networked command with request construction, reference/system-prompt handling, response parsing, MIME/filename switching, and several failure paths, but there is no test covering
cmdGeneratewhile the other imagekit commands have integration coverage. Add deterministic tests with a mocked SDK/transport so these paths can be verified without spending against OpenRouter.
result = await openrouter.chat.send({
chatRequest: {
model,
messages: [
...(systemInstructions
? [{ role: "system" as const, content: systemInstructions }]
: []),
{
role: "user" as const,
content: [{ type: "text" as const, text: prompt }, ...references],
},
],
modalities: ["image", "text"],
},
});
- Files reviewed: 7/8 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| { | ||
| "name": "@ponti-studios/imagekit", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", |
| process.exit(1); | ||
| } | ||
|
|
||
| const match = image.imageUrl.url.match(/^data:image\/(\w+);base64,(.+)$/); |
| ensureDir(outdir); | ||
|
|
||
| const bg = opts.bg; | ||
| const safeZone = Math.min(1, Math.max(0.1, opts.safeZone ?? 0.8)); |
| const source = path.join(FIXTURES, "transparent-rgba.png"); | ||
| const output = path.join(tmp, "icons"); | ||
|
|
||
| const result = runIconkit(["web", source, "-o", output, "--bg", "#0a0a0a", "--safe-zone", "0.7"]); |
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.
Summary
imagekit webgains--bg <color>/--safe-zone <fraction>so square icon outputs (favicons, apple-touch-icon, android/PWA icons, MS tiles) can be flattened onto an opaque background with content padded into the maskable safe zone — fixes OS icon masks clipping content or showing transparency as stray white/black.src/commands/generate.ts, whichindex.tsalready imported but had never been added to git (broken checkout for anyone cloning fresh).@ponti-studios/imagekitto 1.1.0.Test plan
bun run typecheckbun test(57 pass, including new--bg/--safe-zonecoverage)packages/what/public/logo.pngin labs) — output has no alpha channel and content isn't clipped🤖 Generated with Claude Code