makaron-cli 0.17.19 → 0.17.21

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.17.19",
3
+ "version": "0.17.21",
4
4
  "description": "Give Claude Code a creative agent. Pass complete creative requests and source media to Makaron Chat.",
5
5
  "author": {
6
6
  "name": "Versa AI",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.17.19",
3
+ "version": "0.17.21",
4
4
  "description": "Give Codex a creative agent. Pass complete creative requests and source media to Makaron Chat.",
5
5
  "author": {
6
6
  "name": "Versa AI",
package/README.md CHANGED
@@ -755,3 +755,17 @@ makaron chat --image mascot.png "Use GPT Image 2.6 Flare to make a looping GIF o
755
755
  The provider schema also advertises xhigh/max reasoning, but the live 2.6 endpoint rejected both during acceptance. They are not exposed as working Makaron tiers. Exact active 2.6 pricing rows are required before submission; final cost uses that task's fal billable USD units.
756
756
 
757
757
  Seedream 5.5 (`--image-model seedream-5.5`) uses EvoLink, accepts at most 10 ordered inputs (base included), `--image-resolution 1K|1.5K|2K`, and `--output-format png|jpeg` (default PNG). `--background transparent` requires native PNG alpha. Quality/reasoning/GIF/SVG controls are unsupported. It never participates in Auto or switches providers after failure. Direct `makaron edit --image/--ref` uploads local originals automatically; direct MCP callers must supply public HTTPS PNG/JPEG/WebP originals. Accepted task receipts are saved to the user workspace before polling. The server must configure `EVOLINK_API_KEY` and an exact active `seedream-5.5` pricing row before use.
758
+
759
+ ### Image layer decomposition
760
+
761
+ ```bash
762
+ makaron chat --project auto --image poster.png "拆成图层,文字保留图片样式,返回 Makaron 编辑链接"
763
+ makaron layerize --image poster.png --max-outputs 8 --quality 1K --json
764
+ makaron layerize status <jobId> --project <projectId> --json
765
+ ```
766
+
767
+ Both paths return a Makaron `projectUrl`. Open it to move/scale, reorder or delete/restore image layers in the standard GUI. **By default, lettering stays in image layers to preserve its appearance.** For wording changes that should retain the original lettering style, prefer image-model editing of the selected image layer through `makaron chat`. This does not guarantee an exact visual match.
768
+
769
+ Use `--editable-text` only when the user explicitly requests native editable text fields. It makes recognized text editable using approximate fonts; edited wording can differ in typography, texture and styling. A request to split layers or change wording alone does not imply this option. Describe the default result as image layers, including lettering, rather than promising native editable text. The original image and PNG layers remain in the project/workspace.
770
+
771
+ `--project` reuses a project; otherwise the direct command creates a private project. `--max-outputs` is 2–100 including the background (default 8); quality is `auto|1K|1.5K|2K` (default `1K` for faster decomposition). One quality setting applies to the whole task; per-layer resolution controls are unavailable. Use an explicit higher tier or `auto` when preserving source resolution is required. The actual output count and pixel tiers determine one task charge. Failed or uncertain submissions are never replayed automatically; retain the printed job ID and query status. Repeated status reads preserve saved GUI edits and do not debit again. When the layers are ready, the edit link opens the resulting snapshot.
package/bin/makaron.mjs CHANGED
@@ -12,6 +12,7 @@
12
12
  */
13
13
 
14
14
  import fs from 'fs';
15
+ import { randomUUID } from 'node:crypto';
15
16
  import path from 'path';
16
17
  import { createInterface } from 'readline';
17
18
  import { execFileSync } from 'child_process';
@@ -403,7 +404,7 @@ function normalizeRunResponse(data) {
403
404
  const projectId = data.projectId || data.project_id;
404
405
  if (projectId) {
405
406
  data.projectId = projectId;
406
- data.projectUrl = `${APP_URL}/projects/${projectId}`;
407
+ data.projectUrl = data.project_url || `${APP_URL}/projects/${projectId}`;
407
408
  }
408
409
  return data;
409
410
  }
@@ -914,7 +915,7 @@ async function pollRun(baseUrl, headers, runId, opts = {}) {
914
915
  }
915
916
  if (data.result.error) process.stderr.write(`❌ ${data.result.error}\n`);
916
917
  }
917
- process.stderr.write(`🔗 ${APP_URL}/projects/${data.projectId}\n`);
918
+ process.stderr.write(`🔗 ${data.projectUrl}\n`);
918
919
  printRunUsage(data.usage);
919
920
  }
920
921
 
@@ -2211,6 +2212,83 @@ Run "makaron video create --help" for every model, option, example, and limit.
2211
2212
  `);
2212
2213
  }
2213
2214
 
2215
+ function printLayerizeHelp() {
2216
+ console.log(`Usage: makaron layerize --image <file|https-url> [--project <id>] [--json]
2217
+ makaron layerize status <jobId> --project <id> [--json]
2218
+
2219
+ --max-outputs <2..100> Maximum images including background (default 8)
2220
+ --quality <id> auto, 1K, 1.5K, 2K (default 1K)
2221
+ --editable-text Opt in to native editable text only when explicitly requested (default off)
2222
+ --prompt <text> Elements or regions to separate
2223
+ --request-id <uuid> Reuse the original request after interruption
2224
+ --no-wait Return the job and Makaron editing URL immediately
2225
+
2226
+ Returns a normal Makaron design. Open projectUrl to move/scale, reorder or delete/restore image layers.
2227
+ By default, lettering stays in image layers to preserve its appearance. Prefer image-model edits for
2228
+ wording changes that should retain the original lettering style. Native text uses approximate fonts
2229
+ and may change the typography or styling; enable --editable-text only for an explicit native text request.
2230
+ Charges actual output images once; query the same job to recover.
2231
+ Chat alternative: makaron chat --project auto --image poster.png "拆成图层,文字保留图片样式,返回 Makaron 编辑链接"
2232
+ `);
2233
+ }
2234
+
2235
+ async function runLayerize(args) {
2236
+ const { baseUrl, headers } = getAuth();
2237
+ const options = {};
2238
+ const flags = new Set(['--json', '--editable-text', '--no-wait']);
2239
+ const valued = new Set(['--image', '--project', '--max-outputs', '--quality', '--prompt', '--request-id']);
2240
+ const statusOnly = args[1] === 'status';
2241
+ for (let i = statusOnly ? 3 : 1; i < args.length; i++) {
2242
+ const arg = args[i];
2243
+ if (flags.has(arg)) options[arg] = true;
2244
+ else if (valued.has(arg) && args[i + 1] && !args[i + 1].startsWith('--')) options[arg] = args[++i];
2245
+ else throw new Error(`Unknown or incomplete layerize option: ${arg}`);
2246
+ }
2247
+ const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
2248
+ let projectId = options['--project'];
2249
+ const jobId = statusOnly ? args[2] : options['--request-id'] || randomUUID();
2250
+ const n = Number(options['--max-outputs'] || 8), quality = options['--quality'] || '1K';
2251
+ if (!uuid.test(jobId || '') || (projectId && !uuid.test(projectId))) throw new Error('Use valid project/request UUIDs.');
2252
+ if (!statusOnly && (!options['--image'] || !Number.isSafeInteger(n) || n < 2 || n > 100 || !['auto', '1K', '1.5K', '2K'].includes(quality))) throw new Error('Provide --image and valid layerize options; see layerize --help.');
2253
+ if (statusOnly && !projectId) throw new Error('status requires --project <id>.');
2254
+ const request = async (route, body) => {
2255
+ const response = await fetch(`${baseUrl}${route}`, { headers: { ...headers, 'Content-Type': 'application/json' }, ...(body ? { method: 'POST', body: JSON.stringify(body) } : {}) });
2256
+ const data = await response.json();
2257
+ if (!response.ok) throw new Error(data.error || `Layerize HTTP ${response.status}`);
2258
+ return data;
2259
+ };
2260
+ let result;
2261
+ if (!statusOnly) {
2262
+ if (!projectId) {
2263
+ projectId = (await request('/api/projects/create', { title: 'Layerized image' })).projectId;
2264
+ const privacy = await fetch(`${baseUrl}/api/projects/${projectId}/share`, { method: 'PATCH', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ is_public: false }) });
2265
+ if (!privacy.ok || (await request(`/api/projects/${projectId}/share`)).is_public !== false) throw new Error('Could not confirm private project; no decomposition was submitted.');
2266
+ }
2267
+ let imageUrl = options['--image'];
2268
+ if (!isHttpUrl(imageUrl)) [imageUrl] = await uploadImageFilesViaSignedUrl(baseUrl, headers, projectId, [imageUrl]);
2269
+ if (!imageUrl.startsWith('https://')) throw new Error('Layerize requires an uploaded HTTPS original.');
2270
+ // Attach the source once, only for a new job. A resumed request uses status instead.
2271
+ if (!options['--request-id']) await request('/api/projects/create', { _addToProject: projectId, imageUrls: [imageUrl] });
2272
+ process.stderr.write(`Layerize job: ${jobId}\nProject: ${projectId}\nRecovery: makaron layerize status ${jobId} --project ${projectId}\n`);
2273
+ // A paid submission is deliberately never retried on a transport error.
2274
+ result = await request('/api/layerize', { projectId, requestId: jobId, imageUrl, maxOutputs: n, quality, prompt: options['--prompt'], editableText: options['--editable-text'] === true });
2275
+ } else result = await request(`/api/layerize?projectId=${projectId}&jobId=${jobId}`);
2276
+ process.stderr.write(`Edit in Makaron: ${result.projectUrl}\n`);
2277
+ const deadline = Date.now() + 8 * 60_000;
2278
+ while (!options['--no-wait'] && ['preparing', 'processing'].includes(result.status) && Date.now() < deadline) {
2279
+ await new Promise(resolve => setTimeout(resolve, 3000));
2280
+ result = await request(`/api/layerize?projectId=${projectId}&jobId=${jobId}`);
2281
+ }
2282
+ if (options['--json']) console.log(JSON.stringify(result));
2283
+ else {
2284
+ console.log(`${result.status === 'completed' ? 'Layers ready. Edit in Makaron' : result.status}: ${result.projectUrl}`);
2285
+ if (result.status !== 'completed') console.log(`Job: ${result.jobId}`);
2286
+ if (result.message) console.log(result.message);
2287
+ if (result.status !== 'completed') console.log(`Resume: makaron layerize status ${jobId} --project ${projectId}`);
2288
+ }
2289
+ if (['failed', 'uncertain'].includes(result.status)) process.exitCode = 1;
2290
+ }
2291
+
2214
2292
  function printRootHelp() {
2215
2293
  console.log(`Makaron CLI — Talk to Makaron Agent from the terminal
2216
2294
 
@@ -2233,6 +2311,9 @@ Commands:
2233
2311
  create --image-url <url> Create project from URL
2234
2312
  create --title "name" Create empty project (text-to-image)
2235
2313
 
2314
+ layerize --image <file|url> Split into editable design layers; returns Makaron edit URL
2315
+ layerize status <jobId> --project <id> Recover the same layer task
2316
+
2236
2317
  chat --project <id> "message" Chat (non-blocking, polls for result)
2237
2318
  chat --project <id> --image <file> Attach an image or visual reference
2238
2319
  chat --project <id> --skill <id> Use a built-in or marketplace skill
@@ -2325,6 +2406,7 @@ function setupMakaron(values = []) {
2325
2406
  }
2326
2407
 
2327
2408
  function printHelp(topic, subtopic) {
2409
+ if (topic === 'layerize') { printLayerizeHelp(); return; }
2328
2410
  if (topic === 'login') {
2329
2411
  console.log('Usage: makaron login');
2330
2412
  } else if (topic === 'create') {
@@ -2555,6 +2637,8 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
2555
2637
  process.exit(1);
2556
2638
  }
2557
2639
  await createProject(baseUrl, headers, opts);
2640
+ } else if (command === 'layerize') {
2641
+ try { await runLayerize(args); } catch (error) { console.error(error.message + '\nRetain the printed job ID; query status before any new submission.'); process.exitCode = 1; }
2558
2642
  } else if (command === 'chat') {
2559
2643
  if (args.includes('--help') || args.includes('-h')) {
2560
2644
  printChatHelp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.17.19",
3
+ "version": "0.17.21",
4
4
  "description": "Talk to Makaron Agent from the terminal — create projects, edit images, generate videos",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -576,3 +576,17 @@ The legacy `openai` image-model parameter now resolves to GPT Image 2.6 Flare.
576
576
  Naming Seedance 2.5 in chat defaults to Seedance 2.5 Eco. Use `seedance-2.5-native` only when explicitly requesting native generation; Eco supports 720p/1080p/2K/4K final delivery.
577
577
 
578
578
  Seedream 5.5 (`--image-model seedream-5.5`) uses EvoLink, accepts at most 10 ordered inputs (base included), `--image-resolution 1K|1.5K|2K`, and `--output-format png|jpeg` (default PNG). `--background transparent` requires native PNG alpha. Quality/reasoning/GIF/SVG controls are unsupported. It never participates in Auto or switches providers after failure. Direct `makaron edit --image/--ref` uploads local originals automatically; direct MCP callers must supply public HTTPS PNG/JPEG/WebP originals. Accepted task receipts are saved to the user workspace before polling. The server must configure `EVOLINK_API_KEY` and an exact active `seedream-5.5` pricing row before use.
579
+
580
+ ### Image layer decomposition
581
+
582
+ ```bash
583
+ makaron chat --project auto --image poster.png "拆成图层,文字保留图片样式,返回 Makaron 编辑链接"
584
+ makaron layerize --image poster.png --max-outputs 8 --quality 1K --json
585
+ makaron layerize status <jobId> --project <projectId> --json
586
+ ```
587
+
588
+ Both paths return a Makaron `projectUrl`. Open it to move/scale, reorder or delete/restore image layers in the standard GUI. **By default, lettering stays in image layers to preserve its appearance.** For wording changes that should retain the original lettering style, prefer image-model editing of the selected image layer through `makaron chat`. This does not guarantee an exact visual match.
589
+
590
+ Use `--editable-text` only when the user explicitly requests native editable text fields. It makes recognized text editable using approximate fonts; edited wording can differ in typography, texture and styling. A request to split layers or change wording alone does not imply this option. Describe the default result as image layers, including lettering, rather than promising native editable text. The original image and PNG layers remain in the project/workspace.
591
+
592
+ `--project` reuses a project; otherwise the direct command creates a private project. `--max-outputs` is 2–100 including the background (default 8); quality is `auto|1K|1.5K|2K` (default `1K` for faster decomposition). One quality setting applies to the whole task; per-layer resolution controls are unavailable. Use an explicit higher tier or `auto` when preserving source resolution is required. The actual output count and pixel tiers determine one task charge. Failed or uncertain submissions are never replayed automatically; retain the printed job ID and query status. Repeated status reads preserve saved GUI edits and do not debit again. When the layers are ready, the edit link opens the resulting snapshot.