@dorely13/ai-imagegen-cli 0.1.3 → 0.3.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 CHANGED
@@ -1,137 +1,214 @@
1
- const IMAGE_OPTIONS = `Image options (generate, edit):
2
- --prompt <text> Prompt text (required)
3
- --out <path|dir> Output file or directory (required)
4
- --provider <name> Repeatable. Defaults to the only configured provider;
5
- required when several are configured.
6
- --model <id> Image model override (Codex default gpt-image-2.5-flare)
7
- --reference <file> Reference image for continuity (repeatable, max 4)
8
- --size <size> auto, WIDTHxHEIGHT, aspect (16:9), or preset
9
- square, portrait, landscape, wide (validated per
10
- provider; bad aspects are rejected)
11
- --quality <quality> Quality hint (provider-specific, default auto)
12
- --format <format> png, jpeg, or webp (default png)
13
- --count <n> Number of images, 1-4 (default 1)
14
-
15
- Supported Codex models (account availability is determined by the provider):
16
- gpt-image-2.5-flare Default; fast image generation and editing
17
- gpt-image-2.5-sunburst Higher-precision image generation and editing
18
- gpt-image-2 Previous model; retained for compatibility
19
-
20
- Use full model IDs; other provider-supported IDs may also be supplied.
21
- Model precedence: --model > constructor imageModel (library callers) >
22
- IMAGEGEN_CODEX_IMAGE_MODEL > gpt-image-2.5-flare.
23
- IMAGEGEN_CODEX_MODEL configures orchestration separately; --model selects images.
24
-
25
- Codex quality: auto (default), low, medium, high; Flare/Sunburst also support
26
- xhigh and max. gpt-image-2 rejects xhigh/max.
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.
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 GENERATE_EXAMPLES = `Examples:
29
- imagegen generate --prompt "a lighthouse at dawn" --out ./lighthouse.png
30
- imagegen generate --model gpt-image-2 --prompt "a lighthouse" --out ./classic.png
31
- imagegen generate --model gpt-image-2.5-sunburst --quality max --prompt "a product photo" --out ./product.png
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
+ Codex may override the requested model, quality, and size; results report the
67
+ returned dimensions. Codex ignores --mask; describe the region in the prompt.
68
+ IMAGEGEN_USAGE_LOG=<file> appends one prompt-free JSON usage line per result.
69
+
70
+ Codex quality: auto (default), low, medium, high; Flare/Sunburst also support
71
+ xhigh and max. gpt-image-2 rejects xhigh/max.
32
72
  `;
33
- const EDIT_EXAMPLES = `Edit options:
34
- --source <file> Source image (required)
35
- --mask <file> Optional edit mask
36
-
37
- Examples:
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
73
+ const GENERATE_EXAMPLES = `Examples:
74
+ imagegen generate --provider gemini --size 16:9 --prompt "a lighthouse at dawn" --out ./gemini.png
75
+ imagegen generate --prompt "a lighthouse at dawn" --out ./lighthouse.png
76
+ imagegen generate --model gpt-image-2 --prompt "a lighthouse" --out ./classic.png
77
+ imagegen generate --model gpt-image-2.5-sunburst --quality max --prompt "a product photo" --out ./product.png
40
78
  `;
41
- export const USAGE = `imagegen - provider-agnostic image generation CLI
42
-
43
- Usage:
44
- imagegen auth codex login [--timeout <minutes>] [--no-open]
45
- imagegen auth codex status [--show-path]
46
- imagegen auth codex logout
47
- imagegen generate --prompt <text> --out <path|dir> [--provider <name>] [options]
48
- imagegen edit --prompt <text> --source <file> [--mask <file>] --out <path|dir> [--provider <name>] [options]
49
- imagegen providers
50
- imagegen skill
51
- imagegen skill install --target <claude|codex|skills-dir> [--target <...>] [--force]
52
- imagegen help [command]
53
-
54
- ${IMAGE_OPTIONS}
55
- ${GENERATE_EXAMPLES}
56
- ${EDIT_EXAMPLES}
57
-
58
- Auth options:
59
- --timeout <minutes> Login wait timeout (default 10)
60
- --no-open Print the URL without opening a browser
61
- --show-path Show where tokens are stored (auth status)
62
-
63
- Global:
64
- -h, --help Show help and exit 0
79
+ const EDIT_EXAMPLES = `Edit options:
80
+ --source <file> Source image (required)
81
+ --mask <file> Optional edit mask (openai-images; Codex ignores it)
82
+
83
+ Examples:
84
+ imagegen edit --format webp --source ./product.png --prompt "make the product blue" --out ./blue.webp
85
+ imagegen edit --model gpt-image-2.5-sunburst --quality max --source ./product.png --prompt "add a ribbon" --out ./ribbon.png
86
+ `;
87
+ export const USAGE = `imagegen - provider-agnostic image generation CLI
88
+
89
+ Usage:
90
+ imagegen auth gemini login [--key-stdin]
91
+ imagegen auth gemini status [--show-path]
92
+ imagegen auth gemini logout
93
+ imagegen auth codex login [--timeout <minutes>] [--no-open]
94
+ imagegen auth codex status [--show-path]
95
+ imagegen auth codex logout
96
+ imagegen generate --prompt <text> --out <path|dir> [--provider <name>] [options]
97
+ imagegen edit --prompt <text> --source <file> [--mask <file>] --out <path|dir> [--provider <name>] [options]
98
+ imagegen providers
99
+ imagegen models --provider <profile-name>
100
+ imagegen skill
101
+ imagegen skill install --target <claude|codex|skills-dir> [--target <...>] [--force]
102
+ imagegen help [command]
103
+
104
+ ${PROFILE_HELP}
105
+ ${IMAGE_OPTIONS}
106
+ ${GENERATE_EXAMPLES}
107
+ ${EDIT_EXAMPLES}
108
+
109
+ Auth options:
110
+ --key-stdin Read an API key from explicit stdin; otherwise hidden
111
+ terminal entry. Keys are stored in the vault/file fallback.
112
+ --timeout <minutes> Login wait timeout (default 10)
113
+ --no-open Print the URL without opening a browser
114
+ --show-path Show where tokens are stored (auth status)
115
+
116
+ Global:
117
+ -h, --help Show help and exit 0
65
118
  `;
66
119
  const COMMAND_HELP = {
67
- auth: `imagegen auth - manage provider credentials (one namespace per provider)
68
-
69
- Usage:
70
- imagegen auth codex login [--timeout <minutes>] [--no-open]
71
- imagegen auth codex status [--show-path]
72
- imagegen auth codex logout
120
+ auth: `imagegen auth - manage provider credentials (one namespace per provider)
121
+
122
+ ${PROFILE_HELP}
123
+
124
+ Usage:
125
+ imagegen auth gemini login [--key-stdin]
126
+ imagegen auth gemini status [--show-path]
127
+ imagegen auth gemini logout
128
+ imagegen auth codex login [--timeout <minutes>] [--no-open]
129
+ imagegen auth codex status [--show-path]
130
+ imagegen auth codex logout
73
131
  `,
74
- login: `imagegen auth codex login - connect Codex via browser OAuth
75
-
76
- Usage:
77
- imagegen auth codex login [--timeout <minutes>] [--no-open]
78
-
79
- Starts a temporary localhost callback server, opens the browser,
80
- exchanges the code, and stores tokens in the OS vault (file fallback).
132
+ login: `imagegen auth login - connect Gemini with an API key or Codex via OAuth
133
+
134
+ Usage:
135
+ imagegen auth gemini login [--key-stdin]
136
+ imagegen auth gemini status [--show-path]
137
+ imagegen auth gemini logout
138
+ imagegen auth codex login [--timeout <minutes>] [--no-open]
139
+
140
+ Gemini login reads a hidden API key (or explicit --key-stdin), stores it in the
141
+ OS vault with file fallback, and makes no paid verification request.
142
+ Codex login starts a temporary localhost callback server, opens the browser,
143
+ exchanges the code, and stores tokens in the OS vault (file fallback).
81
144
  `,
82
- status: `imagegen auth codex status - show Codex connection state
83
-
84
- Usage:
85
- imagegen auth codex status [--show-path]
86
-
87
- Prints JSON without secrets. --show-path reveals the token location.
145
+ status: `imagegen auth status - show provider connection state
146
+
147
+ Usage:
148
+ imagegen auth gemini status [--show-path]
149
+ imagegen auth codex status [--show-path]
150
+
151
+ Prints JSON without secrets. --show-path reveals the credential location.
152
+ Gemini status is local configured state, not API-key validity.
88
153
  `,
89
- logout: `imagegen auth codex logout - remove stored Codex credentials
90
-
91
- Usage:
92
- imagegen auth codex logout
154
+ logout: `imagegen auth logout - remove stored provider credentials
155
+
156
+ Usage:
157
+ imagegen auth gemini logout
158
+ imagegen auth codex logout
93
159
  `,
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
- ${IMAGE_OPTIONS}
100
- ${GENERATE_EXAMPLES}
160
+ generate: `imagegen generate - create images from a prompt
161
+
162
+ Usage:
163
+ imagegen generate --prompt <text> --out <path|dir> [--provider <name>] [options]
164
+
165
+ ${PROFILE_HELP}
166
+ ${IMAGE_OPTIONS}
167
+ ${GENERATE_EXAMPLES}
101
168
  `,
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}
169
+ edit: `imagegen edit - edit a source image with a prompt
170
+
171
+ Usage:
172
+ imagegen edit --prompt <text> --source <file> [--mask <file>] --out <path|dir> [--provider <name>] [options]
173
+
174
+ ${IMAGE_OPTIONS}
175
+ ${EDIT_EXAMPLES}
109
176
  `,
110
- providers: `imagegen providers - list registered and configured providers
111
-
112
- Usage:
113
- imagegen providers
114
-
115
- Prints JSON with each provider and whether it is configured.
177
+ providers: `imagegen providers - list providers and manage named endpoints
178
+
179
+ Usage:
180
+ imagegen providers
181
+
182
+ Prints JSON with each provider and whether it is configured.
183
+
184
+ ${PROFILE_HELP}`,
185
+ models: `imagegen models - discover models for a named endpoint profile
186
+
187
+ Usage:
188
+ imagegen models --provider <profile-name>
189
+
190
+ Discovery is explicit and may require saved credentials. OpenRouter returns image
191
+ models and reported capabilities; generic /models results have unknown image
192
+ capabilities. This command does not generate images.
116
193
  `,
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.
194
+ skill: `imagegen skill - print or install the reusable agent skill
195
+
196
+ Usage:
197
+ imagegen skill
198
+ imagegen skill install --target <claude|codex|skills-dir> [--target <...>] [--force]
199
+
200
+ Without install, prints SKILL.md as Markdown. Install accepts repeatable targets:
201
+ claude ~/.claude/skills/imagegen-cli/SKILL.md
202
+ codex ~/.agents/skills/imagegen-cli/SKILL.md
203
+ <skills-dir> <skills-dir>/imagegen-cli/SKILL.md
204
+
205
+ Install prints JSON with each path and status. Existing different content is
206
+ preserved unless --force is passed.
130
207
  `,
131
- help: `imagegen help - show human-readable usage
132
-
133
- Usage:
134
- imagegen help [command]
208
+ help: `imagegen help - show human-readable usage
209
+
210
+ Usage:
211
+ imagegen help [command]
135
212
  `,
136
213
  };
137
214
  export function helpFor(topic) {