focalapi-cli 0.5.0 → 0.5.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.1 - 2026-08-26
4
+
5
+ - Added `@file` support to `--style-references` and `--moodboards`: the JSON array can now be read from a file instead of inline argv. Windows `cmd` mangles embedded double quotes in JSON arguments (matrix-run evidence 2026-08-25), and the file source sidesteps shell quoting entirely.
6
+
3
7
  ## 0.5.0 - 2026-08-25
4
8
 
5
9
  - Fixed `krea-2-medium/-turbo/large` reference-image validation: the local table said 0 while the platform contract accepts up to 10 reference images (each maps to a Krea style reference), so every `gen image --image` edit was rejected locally without reaching the server (2026-08-25 live audit P01).
package/dist/cli.js CHANGED
@@ -176,7 +176,7 @@ function displayWidth(s) {
176
176
  }
177
177
 
178
178
  // src/lib/version.ts
179
- var VERSION = true ? "0.5.0" : "0.0.0-dev";
179
+ var VERSION = true ? "0.5.1" : "0.0.0-dev";
180
180
 
181
181
  // src/commands/auth.ts
182
182
  import { createInterface } from "readline/promises";
@@ -1943,6 +1943,15 @@ function parseJsonArray(raw, option) {
1943
1943
  throw new ApiError("invalid_request", `--${option} must be a JSON array`);
1944
1944
  }
1945
1945
  }
1946
+ async function readJsonArrayArgument(raw, option) {
1947
+ if (!raw.startsWith("@")) return parseJsonArray(raw, option);
1948
+ try {
1949
+ return parseJsonArray((await readFile(normalizeHomePath(raw.slice(1)), "utf8")).trim(), option);
1950
+ } catch (error) {
1951
+ if (error instanceof ApiError) throw error;
1952
+ throw new ApiError("invalid_request", `--${option} @file \u65E0\u6CD5\u8BFB\u53D6\uFF1A${raw.slice(1, 120)}`);
1953
+ }
1954
+ }
1946
1955
  var MAX_CONTENT_FILE_BYTES = 64 * 1024 * 1024;
1947
1956
  async function readContentArgument(raw) {
1948
1957
  if (raw === "-") {
@@ -2079,8 +2088,8 @@ function registerGen(program) {
2079
2088
  const model = opts.model ?? (await resolveCreativeModel(auth, "image")).model.id;
2080
2089
  if (!opts.model && !g.json) info(`\u5DF2\u81EA\u52A8\u9009\u62E9\u56FE\u50CF\u6A21\u578B\uFF1A${model}`);
2081
2090
  const n = clampInt(opts.n, 1, MAX_IMAGE_N, "n");
2082
- const styleReferences = opts.styleReferences ? parseJsonArray(opts.styleReferences, "style-references") : void 0;
2083
- const moodboards = opts.moodboards ? parseJsonArray(opts.moodboards, "moodboards") : void 0;
2091
+ const styleReferences = opts.styleReferences ? await readJsonArrayArgument(opts.styleReferences, "style-references") : void 0;
2092
+ const moodboards = opts.moodboards ? await readJsonArrayArgument(opts.moodboards, "moodboards") : void 0;
2084
2093
  const referenceImages = await resolveMediaInputs(opts.image ?? []);
2085
2094
  const maskImage = (await resolveMediaInputs(opts.mask ? [opts.mask] : []))[0];
2086
2095
  validateImageGeneration(model, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "focalapi-cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "让任意 AI Agent 直接调用 focalapi 创作模型的命令行工具",
5
5
  "type": "module",
6
6
  "bin": {