makaron-cli 0.5.3 → 0.6.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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Makaron CLI — Agent Integration Skill
2
2
 
3
+ > **makaron.app** is for humans. **makaron-cli** is for AI agents.
4
+
3
5
  Makaron is a multimodal AI creative agent. You talk to it via `makaron chat`, and it produces images, videos, music, and animated designs — all saved to a persistent project.
4
6
 
5
7
  ## Setup
@@ -7,12 +9,51 @@ Makaron is a multimodal AI creative agent. You talk to it via `makaron chat`, an
7
9
  ```bash
8
10
  npm install -g makaron-cli
9
11
  # or use directly: npx makaron-cli
12
+ ```
13
+
14
+ ### Get your API key
15
+
16
+ **Option A: Human login**
17
+ 1. Go to [makaron.app](https://makaron.app) and log in
18
+ 2. Open the menu (top-right)
19
+ 3. Click **Get API Key**
20
+ 4. Copy your `mk_live_...` key
21
+
22
+ **Option B: Agent Self-Registration (no human required)**
23
+ ```bash
24
+ # Step 1: Get challenge
25
+ curl -X POST https://www.makaron.app/api/agent/register
26
+
27
+ # Step 2: Solve the obfuscated math problem and verify
28
+ curl -X POST https://www.makaron.app/api/agent/register/verify \
29
+ -H "Content-Type: application/json" \
30
+ -d '{"challenge_id": "...", "answer": "34.5"}'
31
+ # → { "api_key": "mk_live_...", "credits": 500 }
32
+ ```
33
+
34
+ Discovery endpoint (returns full registration flow + CLI usage as JSON):
35
+ ```bash
36
+ curl https://www.makaron.app/api/agent/register
37
+ ```
10
38
 
39
+ Docs: [makaron.app/agent](https://www.makaron.app/agent)
40
+
41
+ ```bash
11
42
  export MAKARON_API_KEY=mk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
12
43
  ```
13
44
 
14
45
  Verify: `npx makaron-cli list` should show projects.
15
46
 
47
+ ### Let a human claim your account
48
+
49
+ After registering, you can generate a link for a human to link your API key to their account:
50
+ ```bash
51
+ curl -X POST https://www.makaron.app/api/agent/claim \
52
+ -H "Authorization: Bearer mk_live_your_key"
53
+ # → { "claim_url": "https://www.makaron.app/claim?token=clm_..." }
54
+ ```
55
+ Share the `claim_url` with a human. They log in and the API key gets linked to their account.
56
+
16
57
  ## Core Workflow
17
58
 
18
59
  ```bash
@@ -181,7 +222,7 @@ type MakaronOutput =
181
222
  | Add/remove elements | "add a cat on the table" / "remove background person" |
182
223
  | Text-to-image | "generate a cyberpunk cityscape" |
183
224
  | Video from image | "create a 5 second video of her walking" |
184
- | Video with model | "seedance模型做5秒视频" |
225
+ | Video with model | "use seedance model, make a 5s video" |
185
226
  | Background music | "add calm piano music" |
186
227
  | Motion design | "create an Instagram story with animated text" |
187
228
  | Multi-step | "edit the photo then make a video from it" |
@@ -191,15 +232,15 @@ type MakaronOutput =
191
232
  When serving end-users in a chat environment (Feishu, Slack, Discord), use this proactive message pattern:
192
233
 
193
234
  ```bash
194
- # 1. Immediately reply to user: "收到,开始做"
195
- send_message "收到!正在为你制作..."
235
+ # 1. Immediately acknowledge the user
236
+ send_message "Got it! Working on it now..."
196
237
 
197
238
  # 2. Create project + submit (one command)
198
239
  RUN_ID=$(npx makaron-cli chat --project auto --image photo.jpg -b "make it cinematic and create a 5s video")
199
240
 
200
241
  # 3. Send project link proactively
201
242
  PROJECT_URL=$(npx makaron-cli responses get $RUN_ID --pick project_url)
202
- send_message "项目已创建:$PROJECT_URL"
243
+ send_message "Project created: $PROJECT_URL"
203
244
 
204
245
  # 4. Watch and send each artifact as it appears
205
246
  npx makaron-cli responses watch $RUN_ID --jsonl | while read -r line; do
@@ -215,7 +256,7 @@ npx makaron-cli responses watch $RUN_ID --jsonl | while read -r line; do
215
256
  # Video ready — send as media
216
257
  send_video "$URL"
217
258
  elif [ "$EVENT" = "done" ]; then
218
- send_message "全部完成 "
259
+ send_message "All done!"
219
260
  fi
220
261
  done
221
262
  ```
@@ -223,7 +264,7 @@ done
223
264
  **Key principles for service agents:**
224
265
  - **Proactive, not reactive**: Don't wait for the full run to finish. Send progress messages and artifacts as they appear.
225
266
  - **Media over links**: When possible, send images/videos as native media in the chat (download URL and upload as attachment), not just paste the URL.
226
- - **Immediate acknowledgment**: Reply "收到" within 1 second of receiving user request. Don't make users wait for project creation.
267
+ - **Immediate acknowledgment**: Reply within 1 second of receiving user request. Don't make users wait for project creation.
227
268
  - **Project link early**: Send the project URL right after creation so users can check anytime.
228
269
  - **Stream artifacts**: Use `watch --jsonl` to push each artifact the moment it's ready. An image at 15s should reach the user at 15s, not after the video finishes at 5 minutes.
229
270
 
package/SKILL.md CHANGED
@@ -5,10 +5,39 @@ description: Use Makaron CLI to generate AI images, videos, music, and motion de
5
5
 
6
6
  # Makaron CLI — Agent Integration Skill
7
7
 
8
+ > **makaron.app** is for humans. **makaron-cli** is for AI agents.
9
+
8
10
  Makaron is a multimodal AI creative agent. You talk to it via `makaron chat`, and it produces images, videos, music, and animated designs — all saved to a persistent project.
9
11
 
10
12
  ## Setup
11
13
 
14
+ ### Get your API key
15
+
16
+ **Option A: Human login**
17
+ 1. Go to [makaron.app](https://makaron.app) and log in
18
+ 2. Open the menu (top-right) → **Get API Key**
19
+ 3. Copy your `mk_live_...` key
20
+
21
+ **Option B: Self-Registration (no human required)**
22
+ ```bash
23
+ # Step 1: Get challenge
24
+ curl -X POST https://www.makaron.app/api/agent/register
25
+ # → { "challenge_id": "uuid", "challenge": "obfuscated math problem" }
26
+
27
+ # Step 2: Solve and verify
28
+ curl -X POST https://www.makaron.app/api/agent/register/verify \
29
+ -H "Content-Type: application/json" \
30
+ -d '{"challenge_id": "...", "answer": "34.5"}'
31
+ # → { "api_key": "mk_live_...", "credits": 500 }
32
+
33
+ # Step 3: (Optional) Let a human claim this account
34
+ curl -X POST https://www.makaron.app/api/agent/claim \
35
+ -H "Authorization: Bearer mk_live_your_key"
36
+ # → { "claim_url": "..." } — share with human to link key to their account
37
+ ```
38
+
39
+ Discovery endpoint: `GET https://www.makaron.app/api/agent/register` — returns full registration flow + CLI usage as JSON.
40
+
12
41
  ```bash
13
42
  export MAKARON_API_KEY=mk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
14
43
  ```
@@ -183,7 +212,7 @@ type MakaronOutput =
183
212
  | Add/remove elements | "add a cat on the table" / "remove background person" |
184
213
  | Text-to-image | "generate a cyberpunk cityscape" |
185
214
  | Video from image | "create a 5 second video of her walking" |
186
- | Video with model | "seedance模型做5秒视频" |
215
+ | Video with model | "use seedance model, make a 5s video" |
187
216
  | Background music | "add calm piano music" |
188
217
  | Motion design | "create an Instagram story with animated text" |
189
218
  | Multi-step | "edit the photo then make a video from it" |
@@ -193,15 +222,15 @@ type MakaronOutput =
193
222
  When serving end-users in a chat environment (Feishu, Slack, Discord), use this proactive message pattern:
194
223
 
195
224
  ```bash
196
- # 1. Immediately reply to user: "收到,开始做"
197
- send_message "收到!正在为你制作..."
225
+ # 1. Immediately acknowledge the user
226
+ send_message "Got it! Working on it now..."
198
227
 
199
228
  # 2. Create project + submit (one command)
200
229
  RUN_ID=$(npx makaron-cli chat --project auto --image photo.jpg -b "make it cinematic and create a 5s video")
201
230
 
202
231
  # 3. Send project link proactively
203
232
  PROJECT_URL=$(npx makaron-cli responses get $RUN_ID --pick project_url)
204
- send_message "项目已创建:$PROJECT_URL"
233
+ send_message "Project created: $PROJECT_URL"
205
234
 
206
235
  # 4. Watch and send each artifact as it appears
207
236
  npx makaron-cli responses watch $RUN_ID --jsonl | while read -r line; do
@@ -217,7 +246,7 @@ npx makaron-cli responses watch $RUN_ID --jsonl | while read -r line; do
217
246
  # Video ready — send as media
218
247
  send_video "$URL"
219
248
  elif [ "$EVENT" = "done" ]; then
220
- send_message "全部完成 "
249
+ send_message "All done!"
221
250
  fi
222
251
  done
223
252
  ```
@@ -225,7 +254,7 @@ done
225
254
  **Key principles for service agents:**
226
255
  - **Proactive, not reactive**: Don't wait for the full run to finish. Send progress messages and artifacts as they appear.
227
256
  - **Media over links**: When possible, send images/videos as native media in the chat (download URL and upload as attachment), not just paste the URL.
228
- - **Immediate acknowledgment**: Reply "收到" within 1 second of receiving user request. Don't make users wait for project creation.
257
+ - **Immediate acknowledgment**: Reply within 1 second of receiving user request. Don't make users wait for project creation.
229
258
  - **Project link early**: Send the project URL right after creation so users can check anytime.
230
259
  - **Stream artifacts**: Use `watch --jsonl` to push each artifact the moment it's ready. An image at 15s should reach the user at 15s, not after the video finishes at 5 minutes.
231
260
 
package/bin/makaron.mjs CHANGED
@@ -98,9 +98,18 @@ function getAuth() {
98
98
  }
99
99
  const auth = loadAuth();
100
100
  if (!auth) {
101
- console.error('Not logged in. Set MAKARON_API_KEY or run: npx makaron-cli login');
101
+ console.error('No API key found. Set MAKARON_API_KEY or run:');
102
+ console.error(' npx makaron-cli register --json (agent self-registration)');
103
+ console.error(' npx makaron-cli login (human interactive login)');
102
104
  process.exit(1);
103
105
  }
106
+ // Registered via `register --verify` (saved as _apiKey)
107
+ if (auth._apiKey) {
108
+ return {
109
+ headers: { 'Authorization': `Bearer ${auth._apiKey}` },
110
+ baseUrl: process.env.MAKARON_URL || auth._baseUrl || BASE_URL,
111
+ };
112
+ }
104
113
  return {
105
114
  headers: { 'Cookie': buildCookie(auth) },
106
115
  baseUrl: process.env.MAKARON_URL || auth._baseUrl || BASE_URL,
@@ -1026,11 +1035,98 @@ if (command === 'login') {
1026
1035
  admin set-admin <email> Grant admin access to a user
1027
1036
  `);
1028
1037
  }
1038
+ } else if (command === 'register') {
1039
+ const baseUrl = process.env.MAKARON_URL || DEFAULT_URL;
1040
+ const isVerify = args.includes('--verify');
1041
+
1042
+ if (isVerify) {
1043
+ let challengeId = null, answer = null;
1044
+ for (let i = 1; i < args.length; i++) {
1045
+ if (args[i] === '--challenge-id' && args[i + 1]) challengeId = args[++i];
1046
+ else if (args[i] === '--answer' && args[i + 1]) answer = args[++i];
1047
+ }
1048
+ if (!challengeId || !answer) {
1049
+ console.error('Usage: makaron register --verify --challenge-id <id> --answer <number>');
1050
+ process.exit(1);
1051
+ }
1052
+ const res = await fetch(`${baseUrl}/api/agent/register/verify`, {
1053
+ method: 'POST',
1054
+ headers: { 'Content-Type': 'application/json' },
1055
+ body: JSON.stringify({ challenge_id: challengeId, answer }),
1056
+ });
1057
+ const data = await res.json();
1058
+ if (!res.ok) {
1059
+ console.error(`Registration failed: ${data.error || data.message || res.status}`);
1060
+ process.exit(1);
1061
+ }
1062
+ // Save key to auth file
1063
+ saveAuth({ _apiKey: data.api_key, _baseUrl: baseUrl });
1064
+ // Request claim URL
1065
+ let claimUrl = null;
1066
+ try {
1067
+ const claimRes = await fetch(`${baseUrl}/api/agent/claim`, {
1068
+ method: 'POST',
1069
+ headers: { 'Authorization': `Bearer ${data.api_key}`, 'Content-Type': 'application/json' },
1070
+ });
1071
+ const claimData = await claimRes.json();
1072
+ if (claimRes.ok) claimUrl = claimData.claim_url;
1073
+ } catch { /* non-fatal */ }
1074
+ const result = { api_key: data.api_key, credits: data.credits, claim_url: claimUrl };
1075
+ console.log(JSON.stringify(result));
1076
+ console.error(`✅ Registered! Key saved to ${AUTH_FILE}`);
1077
+ if (claimUrl) console.error(`🔗 Claim URL (share with human): ${claimUrl}`);
1078
+ } else {
1079
+ // Check if already has a key
1080
+ const existingKey = process.env.MAKARON_API_KEY;
1081
+ const existingAuth = loadAuth();
1082
+ if (existingKey) {
1083
+ console.error(`Already have API key: ${existingKey.slice(0, 16)}...`);
1084
+ process.exit(0);
1085
+ }
1086
+ if (existingAuth?._apiKey) {
1087
+ console.error(`Already registered: ${existingAuth._apiKey.slice(0, 16)}...`);
1088
+ process.exit(0);
1089
+ }
1090
+ // Request challenge
1091
+ const res = await fetch(`${baseUrl}/api/agent/register`, {
1092
+ method: 'POST',
1093
+ headers: { 'Content-Type': 'application/json' },
1094
+ body: '{}',
1095
+ });
1096
+ const data = await res.json();
1097
+ if (!res.ok) {
1098
+ console.error(`Registration failed: ${data.error || data.message || res.status}`);
1099
+ process.exit(1);
1100
+ }
1101
+ if (args.includes('--json')) {
1102
+ console.log(JSON.stringify(data));
1103
+ } else {
1104
+ console.log(JSON.stringify(data));
1105
+ console.error(`\nChallenge received. Solve and run:`);
1106
+ console.error(` npx makaron-cli register --verify --challenge-id ${data.challenge_id} --answer <your_answer>`);
1107
+ }
1108
+ }
1109
+ } else if (command === 'claim') {
1110
+ const auth = getAuth();
1111
+ const res = await fetch(`${auth.baseUrl}/api/agent/claim`, {
1112
+ method: 'POST',
1113
+ headers: { 'Content-Type': 'application/json', ...auth.headers },
1114
+ });
1115
+ const data = await res.json();
1116
+ if (!res.ok) {
1117
+ console.error(`Claim failed: ${data.error || data.message || res.status}`);
1118
+ process.exit(1);
1119
+ }
1120
+ console.log(JSON.stringify(data));
1121
+ console.error(`🔗 Share this link with a human: ${data.claim_url}`);
1029
1122
  } else {
1030
1123
  console.log(`Makaron CLI — Talk to Makaron Agent from the terminal
1031
1124
 
1032
1125
  Commands:
1033
- login Log in to Makaron
1126
+ register --json Get challenge for agent self-registration
1127
+ register --verify --challenge-id <id> --answer <n> Verify and save API key
1128
+ claim Get claim URL for human to link account
1129
+ login Log in to Makaron (human interactive)
1034
1130
  list (ls) List all projects
1035
1131
  create --image <file> Create project from local image
1036
1132
  create --image-url <url> Create project from URL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "Talk to Makaron Agent from the terminal — create projects, edit images, generate videos",
5
5
  "type": "module",
6
6
  "bin": {