grok-builder-cli 1.0.0 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grok-builder-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Auto-register Grok (x.ai) accounts with temp mail (CloakMail/glx.web.id) and auto-integrate into 9router — multi-threaded CLI",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -32,16 +32,26 @@ function row(num, email, status, elapsed, extra = '') {
32
32
  console.log(` ${dim(String(num).padStart(3))} ${cyan('│')} ${e} ${s} ${t} ${extra}`);
33
33
  }
34
34
 
35
+ // ── Parse CLI args ───────────────────────────────────────────
36
+ const args = process.argv.slice(2);
37
+ const argCount = args.includes('--count') ? parseInt(args[args.indexOf('--count') + 1]) : null;
38
+ const argThreads = args.includes('--threads') ? parseInt(args[args.indexOf('--threads') + 1]) : null;
39
+ const argNoRouter = args.includes('--no-router');
40
+
41
+ // Interactive mode: only prompt if no args provided
42
+ const interactive = !argCount && !argThreads;
43
+
35
44
  // ── Interactive prompt ───────────────────────────────────────
36
- const rl = readline.createInterface({ input, output });
45
+ const rl = interactive ? readline.createInterface({ input, output }) : null;
37
46
 
38
47
  async function ask(q, defaultVal) {
39
- const answer = await rl.question(`${cyan('?')} ${bold(q)} ${defaultVal ? dim(`(${defaultVal}) `) : ''}`);
48
+ if (!interactive) return defaultVal;
49
+ const answer = await rl.question(`${cyan('?')} ${bold(q)} ${defaultVal !== undefined ? dim(`(${defaultVal}) `) : ''}`);
40
50
  return answer.trim() || defaultVal;
41
51
  }
42
52
 
43
53
  function closePrompt() {
44
- rl.close();
54
+ if (rl) rl.close();
45
55
  }
46
56
 
47
57
  // ── Main ──────────────────────────────────────────────────────
@@ -72,13 +82,11 @@ async function main() {
72
82
 
73
83
  // ── Interactive questions ───────────────────────────────────
74
84
  console.log();
75
- const countStr = await ask('How many accounts to create?', '5');
76
- const count = parseInt(countStr) || 5;
85
+ const count = argCount || parseInt(await ask('How many accounts to create?', '5')) || 5;
77
86
 
78
- const threadsStr = await ask('How many parallel threads?', '2');
79
- const threads = parseInt(threadsStr) || 2;
87
+ const threads = argThreads || parseInt(await ask('How many parallel threads?', '2')) || 2;
80
88
 
81
- const addRouter = (await ask('Auto-add to 9router?', 'y')).toLowerCase() === 'y';
89
+ const addRouter = argNoRouter ? false : (await ask('Auto-add to 9router?', 'y')).toLowerCase() === 'y';
82
90
 
83
91
  let routerOk = false;
84
92
  if (addRouter) {
package/src/mail.js CHANGED
@@ -35,22 +35,37 @@ export async function fetchEmails(addr) {
35
35
  if (!res.ok) throw new Error(`Inbox fetch failed: ${res.status}`);
36
36
  const json = await res.json();
37
37
 
38
- // Parse SvelteKit __data.json format
38
+ // Parse SvelteKit __data.json compact format
39
+ // raw = [descriptor, addr_str, [email_indices...], email_obj_with_refs...]
40
+ // descriptor = {address: refIndex, emails: refIndex, pagination: refIndex}
41
+ // email_obj = {id: refIndex, to: refIndex, from: refIndex, subject: refIndex, ...}
42
+ function resolveCompact(v, raw, depth = 0) {
43
+ if (depth > 50) return v; // prevent circular refs
44
+ if (typeof v === 'number') return resolveCompact(raw[v], raw, depth + 1);
45
+ if (Array.isArray(v)) return v.map(i => resolveCompact(i, raw, depth + 1));
46
+ if (v && typeof v === 'object' && !Array.isArray(v)) {
47
+ const obj = {};
48
+ for (const [k, val] of Object.entries(v)) {
49
+ obj[k] = resolveCompact(val, raw, depth + 1);
50
+ }
51
+ return obj;
52
+ }
53
+ return v;
54
+ }
55
+
39
56
  for (const node of json.nodes || []) {
40
57
  if (node?.type === 'data') {
41
- const data = node.data;
42
- // data = [address_string, emails_array, pagination_object]
43
- if (Array.isArray(data)) {
44
- if (data.length >= 2 && Array.isArray(data[1])) return data[1];
45
- if (data.length >= 3 && Array.isArray(data[2])) return data[2];
58
+ const raw = node.data;
59
+ if (Array.isArray(raw)) {
60
+ // Descriptor is first item after resolving
61
+ const descriptor = resolveCompact(raw[0], raw);
62
+ if (descriptor && Array.isArray(descriptor.emails)) return descriptor.emails;
63
+ } else if (raw?.emails && Array.isArray(raw.emails)) {
64
+ return raw.emails;
46
65
  }
47
- // alternative: data = {address, emails, pagination}
48
- if (data?.emails && Array.isArray(data.emails)) return data.emails;
49
66
  }
50
67
  }
51
68
 
52
- // Fallback: try parsing from page data at top level
53
- if (json?.data?.emails) return json.data.emails;
54
69
  return [];
55
70
  }
56
71
 
package/src/signup.js CHANGED
@@ -8,7 +8,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
8
  const TS_EXT = path.resolve(__dirname, '..', 'turnstilePatch');
9
9
  const SIGNUP_URL = 'https://accounts.x.ai/sign-up?redirect=grok-com';
10
10
 
11
- const PASSWORD = process.env.PASSWORD || 'GrokBuilder2024!Secure';
11
+ const PASSWORD = process.env.PASSWORD || 'MySecurePass123!@';
12
12
 
13
13
  /**
14
14
  * Run one signup flow + optional 9router addition