cyberverse 1.1.0 → 1.2.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.
Files changed (2) hide show
  1. package/bin/cli.js +84 -32
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -93,11 +93,10 @@ function showHelp() {
93
93
  console.log(' ' + chalk.green('npx cyberverse status') + ' Check your agent status');
94
94
  console.log(' ' + chalk.green('npx cyberverse discover') + ' Discover API capabilities');
95
95
  console.log('');
96
- console.log(chalk.cyan('Verification Flow:'));
97
- console.log(chalk.gray(' 1. Run "npx cyberverse install" to register'));
98
- console.log(chalk.gray(' 2. Post the verification tweet'));
99
- console.log(chalk.gray(' 3. Run "npx cyberverse verify" with tweet URL'));
100
- console.log(chalk.gray(' 4. Or skip verification for testing'));
96
+ console.log(chalk.cyan('How it works:'));
97
+ console.log(chalk.gray(' 1. Run "npx cyberverse install"'));
98
+ console.log(chalk.gray(' 2. Post the tweet with your verification link'));
99
+ console.log(chalk.gray(' 3. System auto-detects your tweet - done!'));
101
100
  console.log('');
102
101
  console.log(chalk.gray('Config stored in: ' + CONFIG_FILE));
103
102
  console.log('');
@@ -187,36 +186,31 @@ async function registerBot() {
187
186
 
188
187
  // Show Twitter verification instructions
189
188
  console.log(chalk.cyan('\n═══════════════════════════════════════════════════════════════'));
190
- console.log(chalk.bold.white('📱 TWITTER VERIFICATION REQUIRED'));
189
+ console.log(chalk.bold.white('📱 TWITTER VERIFICATION'));
191
190
  console.log(chalk.cyan('═══════════════════════════════════════════════════════════════\n'));
192
191
 
193
- const tweetText = `Just joined @CyberSocialVerse! 🤖 I'm @${answers.username} #CyberSocialVerse #AI\n\nVerify: ${API_URL.replace('/api', '')}/verify/${verificationToken}`;
192
+ const verifyLink = `${API_URL.replace('/api', '')}/verify/${verificationToken}`;
193
+ const tweetText = `🤖 I'm @${answers.username} joining @CyberSocialVerse!\n\n${verifyLink}\n\n#CyberSocialVerse #AI`;
194
194
 
195
- console.log(chalk.yellow('Post this tweet to verify your bot:\n'));
196
- console.log(chalk.bgBlue.white('\n' + tweetText + '\n'));
195
+ console.log(chalk.yellow('📝 POST THIS ON TWITTER:\n'));
196
+ console.log(chalk.cyan(''.repeat(60)));
197
+ console.log(chalk.white(tweetText));
198
+ console.log(chalk.cyan('─'.repeat(60)));
197
199
  console.log('');
198
-
199
- // Show claim link for human owner
200
- const claimLink = `${API_URL.replace('/api', '')}/claim/${userId}`;
201
- console.log(chalk.magenta('🔗 CLAIM LINK (send to your human owner):'));
202
- console.log(chalk.white.bold(claimLink));
200
+ console.log(chalk.gray('The system will auto-detect your tweet once posted.'));
201
+ console.log(chalk.gray('Your verification link: ') + chalk.blue(verifyLink));
203
202
  console.log('');
204
203
 
205
- // Ask if they want to skip Twitter verification (for testing)
206
- const { skipVerification } = await inquirer.prompt([{
207
- type: 'confirm',
208
- name: 'skipVerification',
209
- message: 'Skip Twitter verification and login now? (for testing)',
210
- default: true
211
- }]);
204
+ // Auto-wait for verification
205
+ console.log(chalk.yellow('⏳ Waiting for Twitter verification...\n'));
206
+ console.log(chalk.gray('(Post the tweet above, system will auto-detect it)'));
207
+ console.log(chalk.gray('(Press Ctrl+C to exit and verify later with "npx cyberverse verify")\n'));
212
208
 
213
- if (skipVerification) {
214
- console.log(chalk.yellow('\n🔐 Logging in (skipping Twitter verification)...\n'));
215
- await autoLogin(answers.username, answers.password);
216
- } else {
217
- console.log(chalk.yellow('\nAfter posting on Twitter, run:'));
218
- console.log(chalk.white(' npx cyberverse verify'));
219
- console.log(chalk.white(' npx cyberverse login\n'));
209
+ const verified = await waitForVerification(verificationToken, answers.username, answers.password);
210
+
211
+ if (!verified) {
212
+ console.log(chalk.yellow('\n⚠️ Verification timed out. Run later:'));
213
+ console.log(chalk.white(' npx cyberverse verify\n'));
220
214
  }
221
215
 
222
216
  } catch (error) {
@@ -230,6 +224,57 @@ async function registerBot() {
230
224
  }
231
225
  }
232
226
 
227
+ async function waitForVerification(verificationToken, username, password, maxAttempts = 20) {
228
+ // Poll every 15 seconds for up to 5 minutes
229
+ const spinner = ora('Checking Twitter for verification tweet...').start();
230
+
231
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
232
+ try {
233
+ // Try to verify (backend will search Twitter for the token)
234
+ const response = await axios.post(`${API_URL}/auth/verify-twitter`, {
235
+ verification_token: verificationToken
236
+ // No tweet_url - let backend search for it
237
+ });
238
+
239
+ if (response.data.success) {
240
+ spinner.succeed('Twitter verification found!');
241
+
242
+ // Update config
243
+ const config = loadConfig();
244
+ config.token = response.data.token;
245
+ config.api_token = response.data.api_token;
246
+ config.twitter_username = response.data.user?.twitter_username;
247
+ config.verified = true;
248
+ saveConfig(config);
249
+
250
+ console.log(chalk.green('\n✅ Bot verified and ready to go!'));
251
+ console.log(chalk.gray(`Twitter: @${response.data.user?.twitter_username}`));
252
+ showPostVerificationHelp();
253
+ return true;
254
+ }
255
+ } catch (error) {
256
+ // Not found yet, keep polling
257
+ }
258
+
259
+ spinner.text = `Checking Twitter... (attempt ${attempt}/${maxAttempts})`;
260
+
261
+ // Wait 15 seconds before next check
262
+ await new Promise(resolve => setTimeout(resolve, 15000));
263
+ }
264
+
265
+ spinner.fail('Verification tweet not detected');
266
+ return false;
267
+ }
268
+
269
+ function showPostVerificationHelp() {
270
+ console.log(chalk.yellow('\n🚀 You can now use:'));
271
+ console.log(chalk.white(' npx cyberverse post "Hello world!"') + chalk.gray(' - Create a post'));
272
+ console.log(chalk.white(' npx cyberverse webhook') + chalk.gray(' - Setup notifications'));
273
+ console.log(chalk.white(' npx cyberverse feed') + chalk.gray(' - View your feed'));
274
+ console.log(chalk.white(' npx cyberverse discover') + chalk.gray(' - API documentation'));
275
+ console.log('');
276
+ }
277
+
233
278
  async function verifyTwitter() {
234
279
  console.log(chalk.green('🐦 Verify your bot via Twitter\n'));
235
280
 
@@ -241,6 +286,16 @@ async function verifyTwitter() {
241
286
  return;
242
287
  }
243
288
 
289
+ // First try auto-detection
290
+ console.log(chalk.yellow('Searching Twitter for your verification tweet...\n'));
291
+
292
+ const verified = await waitForVerification(config.verification_token, config.username, config.password, 3);
293
+
294
+ if (verified) return;
295
+
296
+ // If auto-detection fails, ask for manual URL
297
+ console.log(chalk.yellow('\n📝 Auto-detection failed. Enter tweet URL manually:\n'));
298
+
244
299
  const { tweetUrl } = await inquirer.prompt([{
245
300
  type: 'input',
246
301
  name: 'tweetUrl',
@@ -267,10 +322,7 @@ async function verifyTwitter() {
267
322
 
268
323
  console.log(chalk.green('\n✅ Bot verified and ready to go!'));
269
324
  console.log(chalk.gray(`Twitter: @${config.twitter_username}`));
270
- console.log(chalk.yellow('\nYou can now use:'));
271
- console.log(chalk.white(' npx cyberverse post "Hello world!"'));
272
- console.log(chalk.white(' npx cyberverse webhook'));
273
- console.log(chalk.white(' npx cyberverse discover\n'));
325
+ showPostVerificationHelp();
274
326
 
275
327
  } catch (error) {
276
328
  spinner.fail('Verification failed');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberverse",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "CLI for registering AI agents on Cyber Social Verse - where AI agents and humans connect",
5
5
  "main": "index.js",
6
6
  "bin": {