@dorely13/ai-imagegen-cli 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/help.js +196 -121
- package/dist/index.js +1150 -104
- package/dist/index.js.map +1 -1
- package/dist/key-input.js +68 -0
- package/package.json +3 -2
- package/skill/SKILL.md +100 -16
package/dist/help.js
CHANGED
|
@@ -1,137 +1,212 @@
|
|
|
1
|
-
const
|
|
2
|
-
--
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
--
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
const PROFILE_HELP = `Named endpoint profiles:
|
|
2
|
+
imagegen providers add <name> --api <openrouter|openai-images> [--base-url <url>]
|
|
3
|
+
[--model <id>] [--auth <bearer|none>]
|
|
4
|
+
imagegen providers show <name>
|
|
5
|
+
imagegen providers update <name> [--api <format>] [--base-url <url>]
|
|
6
|
+
[--model <id>] [--auth <bearer|none>]
|
|
7
|
+
imagegen providers remove <name>
|
|
8
|
+
imagegen auth <name> login [--key-stdin]
|
|
9
|
+
imagegen auth <name> status [--show-path]
|
|
10
|
+
imagegen auth <name> logout
|
|
11
|
+
imagegen models --provider <name>
|
|
12
|
+
|
|
13
|
+
OpenRouter defaults to https://openrouter.ai/api/v1. openai-images requires
|
|
14
|
+
--base-url including the API prefix (e.g. https://api.openai.com/v1).
|
|
15
|
+
Keys use hidden terminal input or explicit --key-stdin and the existing vault/file
|
|
16
|
+
store. --auth none supports endpoints without keys. Config is saved in providers.json
|
|
17
|
+
alongside the credential file. Origin changes clear the saved key; removing a
|
|
18
|
+
profile removes its credentials. Logout preserves profile configuration.
|
|
19
|
+
|
|
20
|
+
Select named profiles with --provider. Model precedence: --model > profile default;
|
|
21
|
+
provide one if no default is saved. models explicitly discovers model metadata;
|
|
22
|
+
OpenAI-compatible model listings do not establish image capabilities.
|
|
23
|
+
|
|
24
|
+
Supported protocols: OpenRouter dedicated Images API and OpenAI Images JSON /
|
|
25
|
+
multipart endpoints, not arbitrary HTTP templates. Options vary by model.
|
|
26
|
+
OpenRouter accepts aspect ratios; openai-images needs pixels or presets:
|
|
27
|
+
square 1024x1024, portrait 1024x1536, landscape 1536x1024, wide 1536x864.
|
|
28
|
+
Auto options are omitted. Native masks require openai-images or Codex.
|
|
29
|
+
Outputs are measured and converted to PNG/JPEG/WebP without resizing. Count uses
|
|
30
|
+
separate single-image requests without automatic retries or model substitution.
|
|
27
31
|
`;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const IMAGE_OPTIONS = `Image options (generate, edit):
|
|
33
|
+
--prompt <text> Prompt text (required)
|
|
34
|
+
--out <path|dir> Output file or directory (required)
|
|
35
|
+
--provider <name> Repeatable. Defaults to the only configured provider;
|
|
36
|
+
required when several are configured.
|
|
37
|
+
--model <id> Image model override (defaults listed below)
|
|
38
|
+
--reference <file> Reference image for continuity (repeatable, max 4)
|
|
39
|
+
--size <size> auto, WIDTHxHEIGHT, aspect (16:9), or preset
|
|
40
|
+
square, portrait, landscape, wide (validated per
|
|
41
|
+
provider; bad aspects are rejected)
|
|
42
|
+
--quality <quality> Quality hint (provider-specific, default auto)
|
|
43
|
+
--format <format> png, jpeg, or webp (default png)
|
|
44
|
+
--count <n> Number of images, 1-4 (default 1)
|
|
45
|
+
|
|
46
|
+
Gemini provider:
|
|
47
|
+
gemini-nano-banana-2.1 Default; generation, references, and independent edits
|
|
48
|
+
gemini-3-pro-image Precision creative work and brand consistency
|
|
49
|
+
gemini-3.1-flash-image Previous-generation Flash; also supports 512 resolution
|
|
50
|
+
gemini-2.5-flash-image Legacy; up to three inputs including edit source
|
|
51
|
+
--quality auto only; no --mask or guaranteed native alpha transparency.
|
|
52
|
+
--size normalizes to model-native ratios and resolution tiers without resizing.
|
|
53
|
+
auto keeps model defaults; aspect/preset requests use 1K. JSON reports actual pixels.
|
|
54
|
+
PNG/JPEG/WebP output; format conversion happens locally when needed.
|
|
55
|
+
Model precedence: --model > constructor imageModel > IMAGEGEN_GEMINI_IMAGE_MODEL
|
|
56
|
+
> gemini-nano-banana-2.1. Calls are independent; use prior output as --source.
|
|
57
|
+
|
|
58
|
+
Supported Codex models (account availability is determined by the provider):
|
|
59
|
+
gpt-image-2.5-flare Default; fast image generation and editing
|
|
60
|
+
gpt-image-2.5-sunburst Higher-precision image generation and editing
|
|
61
|
+
gpt-image-2 Previous model; retained for compatibility
|
|
62
|
+
|
|
63
|
+
Use full model IDs; other provider-supported IDs may also be supplied.
|
|
64
|
+
Model precedence: --model > constructor imageModel (library callers) >
|
|
65
|
+
IMAGEGEN_CODEX_IMAGE_MODEL > gpt-image-2.5-flare.
|
|
66
|
+
IMAGEGEN_CODEX_MODEL configures orchestration separately; --model selects images.
|
|
67
|
+
|
|
68
|
+
Codex quality: auto (default), low, medium, high; Flare/Sunburst also support
|
|
69
|
+
xhigh and max. gpt-image-2 rejects xhigh/max.
|
|
32
70
|
`;
|
|
33
|
-
const
|
|
34
|
-
--
|
|
35
|
-
--
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
imagegen edit --format webp --source ./product.png --prompt "make the product blue" --out ./blue.webp
|
|
39
|
-
imagegen edit --model gpt-image-2.5-sunburst --quality max --source ./product.png --prompt "add a ribbon" --out ./ribbon.png
|
|
71
|
+
const GENERATE_EXAMPLES = `Examples:
|
|
72
|
+
imagegen generate --provider gemini --size 16:9 --prompt "a lighthouse at dawn" --out ./gemini.png
|
|
73
|
+
imagegen generate --prompt "a lighthouse at dawn" --out ./lighthouse.png
|
|
74
|
+
imagegen generate --model gpt-image-2 --prompt "a lighthouse" --out ./classic.png
|
|
75
|
+
imagegen generate --model gpt-image-2.5-sunburst --quality max --prompt "a product photo" --out ./product.png
|
|
40
76
|
`;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
imagegen
|
|
47
|
-
imagegen
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
imagegen
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
--
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
const EDIT_EXAMPLES = `Edit options:
|
|
78
|
+
--source <file> Source image (required)
|
|
79
|
+
--mask <file> Optional edit mask (Codex or openai-images)
|
|
80
|
+
|
|
81
|
+
Examples:
|
|
82
|
+
imagegen edit --format webp --source ./product.png --prompt "make the product blue" --out ./blue.webp
|
|
83
|
+
imagegen edit --model gpt-image-2.5-sunburst --quality max --source ./product.png --prompt "add a ribbon" --out ./ribbon.png
|
|
84
|
+
`;
|
|
85
|
+
export const USAGE = `imagegen - provider-agnostic image generation CLI
|
|
86
|
+
|
|
87
|
+
Usage:
|
|
88
|
+
imagegen auth gemini login [--key-stdin]
|
|
89
|
+
imagegen auth gemini status [--show-path]
|
|
90
|
+
imagegen auth gemini logout
|
|
91
|
+
imagegen auth codex login [--timeout <minutes>] [--no-open]
|
|
92
|
+
imagegen auth codex status [--show-path]
|
|
93
|
+
imagegen auth codex logout
|
|
94
|
+
imagegen generate --prompt <text> --out <path|dir> [--provider <name>] [options]
|
|
95
|
+
imagegen edit --prompt <text> --source <file> [--mask <file>] --out <path|dir> [--provider <name>] [options]
|
|
96
|
+
imagegen providers
|
|
97
|
+
imagegen models --provider <profile-name>
|
|
98
|
+
imagegen skill
|
|
99
|
+
imagegen skill install --target <claude|codex|skills-dir> [--target <...>] [--force]
|
|
100
|
+
imagegen help [command]
|
|
101
|
+
|
|
102
|
+
${PROFILE_HELP}
|
|
103
|
+
${IMAGE_OPTIONS}
|
|
104
|
+
${GENERATE_EXAMPLES}
|
|
105
|
+
${EDIT_EXAMPLES}
|
|
106
|
+
|
|
107
|
+
Auth options:
|
|
108
|
+
--key-stdin Read an API key from explicit stdin; otherwise hidden
|
|
109
|
+
terminal entry. Keys are stored in the vault/file fallback.
|
|
110
|
+
--timeout <minutes> Login wait timeout (default 10)
|
|
111
|
+
--no-open Print the URL without opening a browser
|
|
112
|
+
--show-path Show where tokens are stored (auth status)
|
|
113
|
+
|
|
114
|
+
Global:
|
|
115
|
+
-h, --help Show help and exit 0
|
|
65
116
|
`;
|
|
66
117
|
const COMMAND_HELP = {
|
|
67
|
-
auth: `imagegen auth - manage provider credentials (one namespace per provider)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
imagegen auth
|
|
118
|
+
auth: `imagegen auth - manage provider credentials (one namespace per provider)
|
|
119
|
+
|
|
120
|
+
${PROFILE_HELP}
|
|
121
|
+
|
|
122
|
+
Usage:
|
|
123
|
+
imagegen auth gemini login [--key-stdin]
|
|
124
|
+
imagegen auth gemini status [--show-path]
|
|
125
|
+
imagegen auth gemini logout
|
|
126
|
+
imagegen auth codex login [--timeout <minutes>] [--no-open]
|
|
127
|
+
imagegen auth codex status [--show-path]
|
|
128
|
+
imagegen auth codex logout
|
|
73
129
|
`,
|
|
74
|
-
login: `imagegen auth
|
|
75
|
-
|
|
76
|
-
Usage:
|
|
77
|
-
imagegen auth
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
130
|
+
login: `imagegen auth login - connect Gemini with an API key or Codex via OAuth
|
|
131
|
+
|
|
132
|
+
Usage:
|
|
133
|
+
imagegen auth gemini login [--key-stdin]
|
|
134
|
+
imagegen auth gemini status [--show-path]
|
|
135
|
+
imagegen auth gemini logout
|
|
136
|
+
imagegen auth codex login [--timeout <minutes>] [--no-open]
|
|
137
|
+
|
|
138
|
+
Gemini login reads a hidden API key (or explicit --key-stdin), stores it in the
|
|
139
|
+
OS vault with file fallback, and makes no paid verification request.
|
|
140
|
+
Codex login starts a temporary localhost callback server, opens the browser,
|
|
141
|
+
exchanges the code, and stores tokens in the OS vault (file fallback).
|
|
81
142
|
`,
|
|
82
|
-
status: `imagegen auth
|
|
83
|
-
|
|
84
|
-
Usage:
|
|
85
|
-
imagegen auth
|
|
86
|
-
|
|
87
|
-
|
|
143
|
+
status: `imagegen auth status - show provider connection state
|
|
144
|
+
|
|
145
|
+
Usage:
|
|
146
|
+
imagegen auth gemini status [--show-path]
|
|
147
|
+
imagegen auth codex status [--show-path]
|
|
148
|
+
|
|
149
|
+
Prints JSON without secrets. --show-path reveals the credential location.
|
|
150
|
+
Gemini status is local configured state, not API-key validity.
|
|
88
151
|
`,
|
|
89
|
-
logout: `imagegen auth
|
|
90
|
-
|
|
91
|
-
Usage:
|
|
92
|
-
imagegen auth
|
|
152
|
+
logout: `imagegen auth logout - remove stored provider credentials
|
|
153
|
+
|
|
154
|
+
Usage:
|
|
155
|
+
imagegen auth gemini logout
|
|
156
|
+
imagegen auth codex logout
|
|
93
157
|
`,
|
|
94
|
-
generate: `imagegen generate - create images from a prompt
|
|
95
|
-
|
|
96
|
-
Usage:
|
|
97
|
-
imagegen generate --prompt <text> --out <path|dir> [--provider <name>] [options]
|
|
98
|
-
|
|
99
|
-
${
|
|
100
|
-
${
|
|
158
|
+
generate: `imagegen generate - create images from a prompt
|
|
159
|
+
|
|
160
|
+
Usage:
|
|
161
|
+
imagegen generate --prompt <text> --out <path|dir> [--provider <name>] [options]
|
|
162
|
+
|
|
163
|
+
${PROFILE_HELP}
|
|
164
|
+
${IMAGE_OPTIONS}
|
|
165
|
+
${GENERATE_EXAMPLES}
|
|
101
166
|
`,
|
|
102
|
-
edit: `imagegen edit - edit a source image with a prompt
|
|
103
|
-
|
|
104
|
-
Usage:
|
|
105
|
-
imagegen edit --prompt <text> --source <file> [--mask <file>] --out <path|dir> [--provider <name>] [options]
|
|
106
|
-
|
|
107
|
-
${IMAGE_OPTIONS}
|
|
108
|
-
${EDIT_EXAMPLES}
|
|
167
|
+
edit: `imagegen edit - edit a source image with a prompt
|
|
168
|
+
|
|
169
|
+
Usage:
|
|
170
|
+
imagegen edit --prompt <text> --source <file> [--mask <file>] --out <path|dir> [--provider <name>] [options]
|
|
171
|
+
|
|
172
|
+
${IMAGE_OPTIONS}
|
|
173
|
+
${EDIT_EXAMPLES}
|
|
109
174
|
`,
|
|
110
|
-
providers: `imagegen providers - list
|
|
111
|
-
|
|
112
|
-
Usage:
|
|
113
|
-
imagegen providers
|
|
114
|
-
|
|
115
|
-
Prints JSON with each provider and whether it is configured.
|
|
175
|
+
providers: `imagegen providers - list providers and manage named endpoints
|
|
176
|
+
|
|
177
|
+
Usage:
|
|
178
|
+
imagegen providers
|
|
179
|
+
|
|
180
|
+
Prints JSON with each provider and whether it is configured.
|
|
181
|
+
|
|
182
|
+
${PROFILE_HELP}`,
|
|
183
|
+
models: `imagegen models - discover models for a named endpoint profile
|
|
184
|
+
|
|
185
|
+
Usage:
|
|
186
|
+
imagegen models --provider <profile-name>
|
|
187
|
+
|
|
188
|
+
Discovery is explicit and may require saved credentials. OpenRouter returns image
|
|
189
|
+
models and reported capabilities; generic /models results have unknown image
|
|
190
|
+
capabilities. This command does not generate images.
|
|
116
191
|
`,
|
|
117
|
-
skill: `imagegen skill - print or install the reusable agent skill
|
|
118
|
-
|
|
119
|
-
Usage:
|
|
120
|
-
imagegen skill
|
|
121
|
-
imagegen skill install --target <claude|codex|skills-dir> [--target <...>] [--force]
|
|
122
|
-
|
|
123
|
-
Without install, prints SKILL.md as Markdown. Install accepts repeatable targets:
|
|
124
|
-
claude ~/.claude/skills/imagegen-cli/SKILL.md
|
|
125
|
-
codex ~/.agents/skills/imagegen-cli/SKILL.md
|
|
126
|
-
<skills-dir> <skills-dir>/imagegen-cli/SKILL.md
|
|
127
|
-
|
|
128
|
-
Install prints JSON with each path and status. Existing different content is
|
|
129
|
-
preserved unless --force is passed.
|
|
192
|
+
skill: `imagegen skill - print or install the reusable agent skill
|
|
193
|
+
|
|
194
|
+
Usage:
|
|
195
|
+
imagegen skill
|
|
196
|
+
imagegen skill install --target <claude|codex|skills-dir> [--target <...>] [--force]
|
|
197
|
+
|
|
198
|
+
Without install, prints SKILL.md as Markdown. Install accepts repeatable targets:
|
|
199
|
+
claude ~/.claude/skills/imagegen-cli/SKILL.md
|
|
200
|
+
codex ~/.agents/skills/imagegen-cli/SKILL.md
|
|
201
|
+
<skills-dir> <skills-dir>/imagegen-cli/SKILL.md
|
|
202
|
+
|
|
203
|
+
Install prints JSON with each path and status. Existing different content is
|
|
204
|
+
preserved unless --force is passed.
|
|
130
205
|
`,
|
|
131
|
-
help: `imagegen help - show human-readable usage
|
|
132
|
-
|
|
133
|
-
Usage:
|
|
134
|
-
imagegen help [command]
|
|
206
|
+
help: `imagegen help - show human-readable usage
|
|
207
|
+
|
|
208
|
+
Usage:
|
|
209
|
+
imagegen help [command]
|
|
135
210
|
`,
|
|
136
211
|
};
|
|
137
212
|
export function helpFor(topic) {
|