claude-rpc 0.13.1 → 0.13.2
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/package.json +1 -1
- package/src/cli.js +50 -13
- package/src/version.js +1 -1
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -1125,7 +1125,31 @@ function profileEnable(on) {
|
|
|
1125
1125
|
userCfg.profile = next;
|
|
1126
1126
|
writeFileSync(CONFIG_PATH, JSON.stringify(userCfg, null, 2));
|
|
1127
1127
|
console.log(`${c.green}✓${c.reset} leaderboard publishing ${on ? 'enabled' : 'disabled'}`);
|
|
1128
|
-
if (on)
|
|
1128
|
+
if (on) {
|
|
1129
|
+
console.log(` ${c.dim}publish now with ${c.reset}${c.cyan}claude-rpc profile publish${c.reset}${c.dim} (or wait for the next daemon flush).${c.reset}`);
|
|
1130
|
+
console.log(` ${c.dim}earn the ✓ with ${c.reset}${c.cyan}claude-rpc profile verify${c.reset}${c.dim}.${c.reset}`);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
// One-shot publish so you appear on the board immediately, instead of waiting
|
|
1135
|
+
// for the daemon's next flush.
|
|
1136
|
+
async function profilePublish() {
|
|
1137
|
+
const cfg = loadConfig();
|
|
1138
|
+
if (!lb.profileIsPublishable(cfg.profile || {})) {
|
|
1139
|
+
return fail('enable the profile first', {
|
|
1140
|
+
hint: 'claude-rpc profile set --handle <name> && claude-rpc profile on', code: EX_BAD_STATE,
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
const { flushProfile } = await import('./community.js');
|
|
1144
|
+
console.log(`${c.dim}publishing @${cfg.profile.handle} to the board…${c.reset}`);
|
|
1145
|
+
const r = await flushProfile(cfg);
|
|
1146
|
+
if (r.ok) {
|
|
1147
|
+
console.log(`${c.green}✓${c.reset} published — see it at ${c.cyan}https://claude-rpc.vercel.app/u/${encodeURIComponent(cfg.profile.handle)}${c.reset}`);
|
|
1148
|
+
} else if (r.reason === 'rate-limited') {
|
|
1149
|
+
console.log(`${c.yellow}!${c.reset} rate-limited — already published in the last minute; the board has you.`);
|
|
1150
|
+
} else {
|
|
1151
|
+
return fail(`publish failed: ${r.reason}${r.error ? ' (' + r.error + ')' : ''}`, { code: EX_SYS_ERROR });
|
|
1152
|
+
}
|
|
1129
1153
|
}
|
|
1130
1154
|
|
|
1131
1155
|
// GitHub verification: ask the worker for a one-time token, publish it in a
|
|
@@ -1161,23 +1185,35 @@ async function profileVerify() {
|
|
|
1161
1185
|
const token = start.json.token;
|
|
1162
1186
|
|
|
1163
1187
|
const { publishGistFile } = await import('./gist.js');
|
|
1164
|
-
console.log(`${c.dim}publishing a proof gist
|
|
1165
|
-
await publishGistFile({
|
|
1166
|
-
svg: `claude-rpc leaderboard verification
|
|
1188
|
+
console.log(`${c.dim}publishing a public proof gist…${c.reset}`);
|
|
1189
|
+
const gist = await publishGistFile({
|
|
1190
|
+
svg: `claude-rpc leaderboard verification\n${token}\n`,
|
|
1167
1191
|
filename: 'claude-rpc-verify.txt',
|
|
1168
1192
|
description: 'claude-rpc profile verification',
|
|
1169
1193
|
isPublic: true,
|
|
1170
1194
|
});
|
|
1171
1195
|
|
|
1172
|
-
|
|
1173
|
-
//
|
|
1174
|
-
|
|
1175
|
-
|
|
1196
|
+
// Hand the worker the gist ID so it fetches that gist directly (no
|
|
1197
|
+
// gist-list lag) and reads the real owner — instant, and the owner becomes
|
|
1198
|
+
// the verified identity regardless of what --github was set to.
|
|
1199
|
+
console.log(`${c.dim}confirming with the server…${c.reset}`);
|
|
1200
|
+
const check = await post('/verify/check', { instanceId: community.instanceId, gistId: gist.id });
|
|
1176
1201
|
if (check.json?.verified) {
|
|
1177
|
-
|
|
1202
|
+
const who = check.json.githubUser || gist.owner || profile.githubUser;
|
|
1203
|
+
// Persist the authoritative owner so the local profile + future publishes
|
|
1204
|
+
// match what got verified.
|
|
1205
|
+
if (who && who !== profile.githubUser) {
|
|
1206
|
+
const userCfg = readJson(CONFIG_PATH, {});
|
|
1207
|
+
userCfg.profile = { ...(userCfg.profile || {}), githubUser: who };
|
|
1208
|
+
writeFileSync(CONFIG_PATH, JSON.stringify(userCfg, null, 2));
|
|
1209
|
+
}
|
|
1210
|
+
console.log(`${c.green}✓${c.reset} verified as @${who} — you'll show the ✓ on the board.`);
|
|
1211
|
+
if (who && profile.githubUser && who.toLowerCase() !== profile.githubUser.toLowerCase()) {
|
|
1212
|
+
console.log(` ${c.dim}(your gist is owned by @${who}, so the profile now uses that account.)${c.reset}`);
|
|
1213
|
+
}
|
|
1178
1214
|
} else {
|
|
1179
|
-
console.log(`${c.yellow}!${c.reset} not confirmed
|
|
1180
|
-
console.log(` ${c.dim}the gist
|
|
1215
|
+
console.log(`${c.yellow}!${c.reset} not confirmed: ${check.json?.error || check.status}`);
|
|
1216
|
+
console.log(` ${c.dim}make sure the gist is public, then re-run ${c.reset}${c.cyan}claude-rpc profile verify${c.reset}${c.dim}.${c.reset}`);
|
|
1181
1217
|
}
|
|
1182
1218
|
} catch (e) {
|
|
1183
1219
|
return fail(`verification failed: ${e.message}`, {
|
|
@@ -1193,8 +1229,9 @@ async function doProfile(argv) {
|
|
|
1193
1229
|
if (sub === 'on') return profileEnable(true);
|
|
1194
1230
|
if (sub === 'off') return profileEnable(false);
|
|
1195
1231
|
if (sub === 'verify') return profileVerify();
|
|
1232
|
+
if (sub === 'publish') return profilePublish();
|
|
1196
1233
|
fail(`unknown profile subcommand: ${sub}`, {
|
|
1197
|
-
hint: 'try: profile [status|set|on|off|verify]',
|
|
1234
|
+
hint: 'try: profile [status|set|on|off|verify|publish]',
|
|
1198
1235
|
code: EX_USER_ERROR,
|
|
1199
1236
|
});
|
|
1200
1237
|
}
|
|
@@ -1336,7 +1373,7 @@ function help() {
|
|
|
1336
1373
|
['public', 'Un-mark the current directory'],
|
|
1337
1374
|
['privacy', 'Show resolved visibility for the current directory'],
|
|
1338
1375
|
['community', 'Opt in/out of anonymous community totals (on|off|status|report)'],
|
|
1339
|
-
['profile', 'Public leaderboard identity
|
|
1376
|
+
['profile', 'Public leaderboard identity (status|set|on|off|publish|verify)'],
|
|
1340
1377
|
['doctor', 'Run a diagnostic checklist — common-failure triage (--fix to auto-repair)'],
|
|
1341
1378
|
['tail', 'Tail the daemon log file'],
|
|
1342
1379
|
['daemon', 'Run daemon in foreground (debug)'],
|