makaron-cli 0.5.4 → 0.6.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/README.md +30 -1
- package/SKILL.md +23 -5
- package/bin/makaron.mjs +98 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,18 +13,47 @@ npm install -g makaron-cli
|
|
|
13
13
|
|
|
14
14
|
### Get your API key
|
|
15
15
|
|
|
16
|
+
**Option A: Human login**
|
|
16
17
|
1. Go to [makaron.app](https://makaron.app) and log in
|
|
17
18
|
2. Open the menu (top-right)
|
|
18
19
|
3. Click **Get API Key**
|
|
19
20
|
4. Copy your `mk_live_...` key
|
|
20
21
|
|
|
22
|
+
**Option B: Agent Self-Registration (no human required)**
|
|
23
|
+
```bash
|
|
24
|
+
# Step 1: Get challenge
|
|
25
|
+
npx makaron-cli register --json
|
|
26
|
+
# → { "challenge_id": "...", "challenge": "...", "expected_format": "numeric, round to 2 decimal places" }
|
|
27
|
+
|
|
28
|
+
# Step 2: Solve the math problem and verify
|
|
29
|
+
npx makaron-cli register --verify --challenge-id <id> --answer 34.5
|
|
30
|
+
# → Key saved to ~/.makaron/auth.json
|
|
31
|
+
# → { "api_key": "mk_live_...", "credits": N, "claim_url": "..." }
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
After registration, the key is saved locally — no need to export `MAKARON_API_KEY`.
|
|
35
|
+
|
|
36
|
+
Discovery endpoint (returns full registration flow + CLI usage as JSON):
|
|
37
|
+
```bash
|
|
38
|
+
curl https://www.makaron.app/api/agent/register
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Docs: [makaron.app/agent](https://www.makaron.app/agent)
|
|
42
|
+
|
|
21
43
|
```bash
|
|
22
44
|
export MAKARON_API_KEY=mk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
23
45
|
```
|
|
24
46
|
|
|
25
47
|
Verify: `npx makaron-cli list` should show projects.
|
|
26
48
|
|
|
27
|
-
|
|
49
|
+
### Let a human claim your account
|
|
50
|
+
|
|
51
|
+
After registering, generate a link for a human to link your API key to their account:
|
|
52
|
+
```bash
|
|
53
|
+
npx makaron-cli claim
|
|
54
|
+
# → { "claim_url": "https://www.makaron.app/claim?token=clm_..." }
|
|
55
|
+
```
|
|
56
|
+
Share the `claim_url` with a human. They log in and the API key gets linked to their account. Claim links are valid for 7 days. Run `claim` again anytime to get a new link.
|
|
28
57
|
|
|
29
58
|
## Core Workflow
|
|
30
59
|
|
package/SKILL.md
CHANGED
|
@@ -13,10 +13,30 @@ Makaron is a multimodal AI creative agent. You talk to it via `makaron chat`, an
|
|
|
13
13
|
|
|
14
14
|
### Get your API key
|
|
15
15
|
|
|
16
|
+
**Option A: Human login**
|
|
16
17
|
1. Go to [makaron.app](https://makaron.app) and log in
|
|
17
|
-
2. Open the menu (top-right)
|
|
18
|
-
3.
|
|
19
|
-
|
|
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
|
+
npx makaron-cli register --json
|
|
25
|
+
# → { "challenge_id": "...", "challenge": "...", "expected_format": "numeric, round to 2 decimal places" }
|
|
26
|
+
|
|
27
|
+
# Step 2: Solve and verify
|
|
28
|
+
npx makaron-cli register --verify --challenge-id <id> --answer 34.5
|
|
29
|
+
# → Key saved to ~/.makaron/auth.json
|
|
30
|
+
# → { "api_key": "mk_live_...", "credits": N, "claim_url": "..." }
|
|
31
|
+
|
|
32
|
+
# (Optional) Let a human claim this account
|
|
33
|
+
npx makaron-cli claim
|
|
34
|
+
# → { "claim_url": "..." } — share with human to link key to their account (valid 7 days)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Discovery endpoint: `GET https://www.makaron.app/api/agent/register` — returns full registration flow + CLI usage as JSON.
|
|
38
|
+
|
|
39
|
+
After self-registration the key is saved locally — no need to export `MAKARON_API_KEY`.
|
|
20
40
|
|
|
21
41
|
```bash
|
|
22
42
|
export MAKARON_API_KEY=mk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
@@ -24,8 +44,6 @@ export MAKARON_API_KEY=mk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
|
24
44
|
|
|
25
45
|
Verify: `npx makaron-cli list` should show projects.
|
|
26
46
|
|
|
27
|
-
> **Agent Self-Registration**: Coming soon — agents will be able to register and obtain API keys programmatically without human login.
|
|
28
|
-
|
|
29
47
|
## Core Workflow
|
|
30
48
|
|
|
31
49
|
```bash
|
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('
|
|
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
|
-
|
|
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
|