@nolimitcli/cli 2.0.0 → 2.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.
Files changed (3) hide show
  1. package/README.md +51 -9
  2. package/dist/index.js +101 -95
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,25 +1,67 @@
1
- # @nolimit/cli
1
+ # @nolimitcli/cli
2
2
 
3
3
  No subscription. Just code.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npx @nolimit/cli
8
+ npx @nolimitcli/cli
9
9
  ```
10
10
 
11
- ## Commands
11
+ Or install globally:
12
12
 
13
13
  ```bash
14
- nolimit auth # Authenticate (get 2K welcome tokens)
15
- nolimit earn # Watch ad to earn 8K tokens
16
- nolimit balance # Check token balance
14
+ npm install -g @nolimitcli/cli
15
+ nolimit
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ Just run the command and start chatting:
21
+
17
22
  ```
23
+ ┌─────────────────────────────┐
24
+ │ NoLimit v2.0.0 │
25
+ │ No subscription. Just code. │
26
+ └─────────────────────────────┘
27
+
28
+ Balance: 2K tokens
29
+
30
+ Commands: /earn · /balance · /help · /quit
31
+ ─────────────────────────────────
32
+
33
+ › Write a function to reverse a string
34
+
35
+ function reverse(str) {
36
+ return str.split('').reverse().join('');
37
+ }
38
+
39
+ ─ 89 tokens used
40
+
41
+
42
+ ```
43
+
44
+ ## Commands
45
+
46
+ | Command | Description |
47
+ |---------|-------------|
48
+ | `/earn` | Watch an ad to earn 8K tokens |
49
+ | `/balance` | Check your token balance |
50
+ | `/clear` | Clear the screen |
51
+ | `/help` | Show all commands |
52
+ | `/quit` | Exit |
18
53
 
19
54
  ## How it works
20
55
 
21
- 1. Watch a 30-second ad
22
- 2. Earn 8,000 tokens
23
- 3. Use tokens for AI prompts
56
+ 1. First run auto-authenticates (2K welcome tokens)
57
+ 2. Type anything to chat with AI
58
+ 3. When tokens run low, type `/earn`
59
+ 4. Watch a 30-second ad in your browser
60
+ 5. Continue chatting
24
61
 
25
62
  No subscription. No credit card. Just code.
63
+
64
+ ## Links
65
+
66
+ - [nolimit.dev](https://nolimit.dev)
67
+ - [GitHub](https://github.com/buzzernetwork/nolimit)
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import ora from 'ora';
5
5
  import open from 'open';
6
6
  import * as readline from 'readline';
7
7
  const API_BASE = 'https://nolimit-production-2589.up.railway.app';
8
- const VERSION = '2.0.0';
8
+ const VERSION = '2.0.1';
9
9
  // Persistent config storage
10
10
  const config = new Conf({
11
11
  projectName: 'nolimit',
@@ -164,123 +164,129 @@ async function main() {
164
164
  });
165
165
  const prompt = () => {
166
166
  rl.question(chalk.green('› '), async (input) => {
167
- const trimmed = input.trim();
168
- if (!trimmed) {
169
- prompt();
170
- return;
171
- }
172
- // Handle commands
173
- if (trimmed.startsWith('/')) {
174
- const cmd = trimmed.toLowerCase();
175
- if (cmd === '/quit' || cmd === '/exit' || cmd === '/q') {
176
- console.log(chalk.dim('\n Goodbye.\n'));
177
- rl.close();
178
- process.exit(0);
179
- }
180
- if (cmd === '/help' || cmd === '/h') {
181
- console.log();
182
- console.log(chalk.dim(' Commands:'));
183
- console.log(chalk.cyan(' /earn') + chalk.dim(' Watch an ad to earn tokens'));
184
- console.log(chalk.cyan(' /balance') + chalk.dim(' Check your token balance'));
185
- console.log(chalk.cyan(' /clear') + chalk.dim(' Clear the screen'));
186
- console.log(chalk.cyan(' /quit') + chalk.dim(' Exit NoLimit'));
187
- console.log();
167
+ try {
168
+ const trimmed = input.trim();
169
+ if (!trimmed) {
188
170
  prompt();
189
171
  return;
190
172
  }
191
- if (cmd === '/earn' || cmd === '/e') {
192
- console.log();
193
- const success = await watchAd(apiKey);
194
- if (success) {
195
- const newData = await getBalance(apiKey);
196
- balance = newData?.balance || balance;
173
+ // Handle commands
174
+ if (trimmed.startsWith('/')) {
175
+ const cmd = trimmed.toLowerCase();
176
+ if (cmd === '/quit' || cmd === '/exit' || cmd === '/q') {
177
+ console.log(chalk.dim('\n Goodbye.\n'));
178
+ rl.close();
179
+ process.exit(0);
197
180
  }
198
- console.log();
199
- prompt();
200
- return;
201
- }
202
- if (cmd === '/balance' || cmd === '/b') {
203
- const data = await getBalance(apiKey);
204
- if (data) {
205
- balance = data.balance;
181
+ if (cmd === '/help' || cmd === '/h') {
206
182
  console.log();
207
- console.log(chalk.dim(' Balance: ') + chalk.bold.white(formatTokens(data.balance)) + chalk.dim(' tokens'));
208
- console.log(chalk.dim(' Earned: ') + formatTokens(data.totalEarned));
209
- console.log(chalk.dim(' Spent: ') + formatTokens(data.totalSpent));
183
+ console.log(chalk.dim(' Commands:'));
184
+ console.log(chalk.cyan(' /earn') + chalk.dim(' Watch an ad to earn tokens'));
185
+ console.log(chalk.cyan(' /balance') + chalk.dim(' Check your token balance'));
186
+ console.log(chalk.cyan(' /clear') + chalk.dim(' Clear the screen'));
187
+ console.log(chalk.cyan(' /quit') + chalk.dim(' Exit NoLimit'));
210
188
  console.log();
189
+ prompt();
190
+ return;
211
191
  }
192
+ if (cmd === '/earn' || cmd === '/e') {
193
+ console.log();
194
+ const success = await watchAd(apiKey);
195
+ if (success) {
196
+ const newData = await getBalance(apiKey);
197
+ balance = newData?.balance || balance;
198
+ }
199
+ console.log();
200
+ prompt();
201
+ return;
202
+ }
203
+ if (cmd === '/balance' || cmd === '/b') {
204
+ const data = await getBalance(apiKey);
205
+ if (data) {
206
+ balance = data.balance;
207
+ console.log();
208
+ console.log(chalk.dim(' Balance: ') + chalk.bold.white(formatTokens(data.balance)) + chalk.dim(' tokens'));
209
+ console.log(chalk.dim(' Earned: ') + formatTokens(data.totalEarned));
210
+ console.log(chalk.dim(' Spent: ') + formatTokens(data.totalSpent));
211
+ console.log();
212
+ }
213
+ prompt();
214
+ return;
215
+ }
216
+ if (cmd === '/clear' || cmd === '/c') {
217
+ showWelcome(balance);
218
+ prompt();
219
+ return;
220
+ }
221
+ console.log(chalk.dim(`\n Unknown command: ${trimmed}\n`));
212
222
  prompt();
213
223
  return;
214
224
  }
215
- if (cmd === '/clear' || cmd === '/c') {
216
- showWelcome(balance);
225
+ // Check if we have enough tokens
226
+ if (balance < 100) {
227
+ console.log();
228
+ console.log(chalk.yellow(' Low tokens.') + chalk.dim(' Watch an ad to continue.'));
229
+ console.log();
230
+ const watch = await new Promise((resolve) => {
231
+ rl.question(chalk.dim(' Watch now? ') + chalk.cyan('[Y/n] '), (answer) => {
232
+ resolve(answer.toLowerCase() !== 'n');
233
+ });
234
+ });
235
+ if (watch) {
236
+ const success = await watchAd(apiKey);
237
+ if (success) {
238
+ const newData = await getBalance(apiKey);
239
+ balance = newData?.balance || balance;
240
+ }
241
+ }
242
+ console.log();
217
243
  prompt();
218
244
  return;
219
245
  }
220
- console.log(chalk.dim(`\n Unknown command: ${trimmed}\n`));
221
- prompt();
222
- return;
223
- }
224
- // Check if we have enough tokens
225
- if (balance < 100) {
226
- console.log();
227
- console.log(chalk.yellow(' Low tokens.') + chalk.dim(' Watch an ad to continue.'));
246
+ // Generate response
228
247
  console.log();
229
- const watch = await new Promise((resolve) => {
230
- rl.question(chalk.dim(' Watch now? ') + chalk.cyan('[Y/n] '), (answer) => {
231
- resolve(answer.toLowerCase() !== 'n');
248
+ const spinner = ora({ text: chalk.dim('Thinking...'), spinner: 'dots' }).start();
249
+ const result = await generate(apiKey, trimmed);
250
+ if (!result) {
251
+ spinner.fail(chalk.red('Failed to generate response'));
252
+ console.log();
253
+ prompt();
254
+ return;
255
+ }
256
+ if (result.text === '__INSUFFICIENT_TOKENS__') {
257
+ spinner.stop();
258
+ console.log(chalk.yellow(' Insufficient tokens.') + chalk.dim(' Watch an ad to continue.'));
259
+ console.log();
260
+ const watch = await new Promise((resolve) => {
261
+ rl.question(chalk.dim(' Watch now? ') + chalk.cyan('[Y/n] '), (answer) => {
262
+ resolve(answer.toLowerCase() !== 'n');
263
+ });
232
264
  });
233
- });
234
- if (watch) {
235
- const success = await watchAd(apiKey);
236
- if (success) {
237
- const newData = await getBalance(apiKey);
238
- balance = newData?.balance || balance;
265
+ if (watch) {
266
+ const success = await watchAd(apiKey);
267
+ if (success) {
268
+ const newData = await getBalance(apiKey);
269
+ balance = newData?.balance || balance;
270
+ }
239
271
  }
272
+ console.log();
273
+ prompt();
274
+ return;
240
275
  }
276
+ spinner.stop();
277
+ // Show response
278
+ console.log(chalk.white(result.text));
241
279
  console.log();
242
- prompt();
243
- return;
244
- }
245
- // Generate response
246
- console.log();
247
- const spinner = ora({ text: chalk.dim('Thinking...'), spinner: 'dots' }).start();
248
- const result = await generate(apiKey, trimmed);
249
- if (!result) {
250
- spinner.fail(chalk.red('Failed to generate response'));
280
+ console.log(chalk.dim(` ─ ${formatTokens(result.tokensUsed)} tokens used`));
251
281
  console.log();
282
+ // Update balance
283
+ balance = Math.max(0, balance - result.tokensUsed);
252
284
  prompt();
253
- return;
254
285
  }
255
- if (result.text === '__INSUFFICIENT_TOKENS__') {
256
- spinner.stop();
257
- console.log(chalk.yellow(' Insufficient tokens.') + chalk.dim(' Watch an ad to continue.'));
258
- console.log();
259
- const watch = await new Promise((resolve) => {
260
- rl.question(chalk.dim(' Watch now? ') + chalk.cyan('[Y/n] '), (answer) => {
261
- resolve(answer.toLowerCase() !== 'n');
262
- });
263
- });
264
- if (watch) {
265
- const success = await watchAd(apiKey);
266
- if (success) {
267
- const newData = await getBalance(apiKey);
268
- balance = newData?.balance || balance;
269
- }
270
- }
271
- console.log();
286
+ catch (error) {
287
+ console.log(chalk.red('\n Error occurred. Please try again.\n'));
272
288
  prompt();
273
- return;
274
289
  }
275
- spinner.stop();
276
- // Show response
277
- console.log(chalk.white(result.text));
278
- console.log();
279
- console.log(chalk.dim(` ─ ${formatTokens(result.tokensUsed)} tokens used`));
280
- console.log();
281
- // Update balance
282
- balance = Math.max(0, balance - result.tokensUsed);
283
- prompt();
284
290
  });
285
291
  };
286
292
  // Handle Ctrl+C gracefully
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolimitcli/cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "description": "No subscription. Just code. AI chat powered by watching ads.",
6
6
  "main": "dist/index.js",