clixad 0.0.1-beta.4 → 0.0.1-beta.5

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/dist/clixad.mjs +16 -10
  2. package/package.json +1 -1
package/dist/clixad.mjs CHANGED
@@ -3051,8 +3051,8 @@ async function githubLogin(client, config, start, invite) {
3051
3051
  saveConfig(config);
3052
3052
  console.log(c.green(`
3053
3053
  \u2713 logged in as ${poll.login}`) + c.dim(poll.email ? ` (${poll.email})` : ""));
3054
- const bonus = poll.created ? c.dim(` (signup bonus ${poll.signupBonus})`) : "";
3055
- console.log(` balance: ${c.bold(String(poll.balance))} credits${bonus}`);
3054
+ const bonus = poll.created ? c.dim(` (signup bonus ${credits(poll.signupBonus)})`) : "";
3055
+ console.log(` balance: ${c.bold(credits(poll.balance))} credits${bonus}`);
3056
3056
  console.log(c.dim(` token stored in ${configPath()}`));
3057
3057
  return;
3058
3058
  }
@@ -3079,10 +3079,11 @@ async function devLogin(client, config, email, invite) {
3079
3079
  config.email = res.email;
3080
3080
  saveConfig(config);
3081
3081
  console.log(c.green(`\u2713 logged in as ${res.email}`));
3082
- console.log(` balance: ${c.bold(String(res.balance))} credits (signup bonus)`);
3082
+ console.log(` balance: ${c.bold(credits(res.balance))} credits (signup bonus)`);
3083
3083
  console.log(c.dim(` token stored in ${configPath()}`));
3084
3084
  }
3085
3085
  var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
3086
+ var credits = (n) => n.toLocaleString("en-US");
3086
3087
  function logout(config) {
3087
3088
  delete config.token;
3088
3089
  delete config.userId;
@@ -3094,7 +3095,7 @@ async function whoami(client, config) {
3094
3095
  if (!config.token) return console.log(c.yellow("not logged in \u2014 run `clixad login`"));
3095
3096
  const w = await client.wallet();
3096
3097
  console.log(`${c.bold(config.email ?? "unknown")} \xB7 model ${c.cyan(config.model)}`);
3097
- console.log(`balance: ${c.bold(String(w.balance))} credits \xB7 ${earnedToday(w)}`);
3098
+ console.log(`balance: ${c.bold(credits(w.balance))} credits \xB7 ${earnedToday(w)}`);
3098
3099
  }
3099
3100
  function earnedToday(w) {
3100
3101
  const offers = `${w.ads_today} offer${w.ads_today === 1 ? "" : "s"}`;
@@ -3207,7 +3208,7 @@ async function buyCmd(client, config, pack) {
3207
3208
  const balance = (await safeWallet(client))?.balance ?? before;
3208
3209
  if (balance > before) {
3209
3210
  console.log(c.green(`
3210
- \u2713 +${(balance - before).toLocaleString("en-US")} credits`) + ` \xB7 balance ${c.bold(String(balance))}`);
3211
+ \u2713 +${credits(balance - before)} credits`) + ` \xB7 balance ${c.bold(credits(balance))}`);
3211
3212
  return;
3212
3213
  }
3213
3214
  }
@@ -3291,10 +3292,6 @@ async function codeCmd(client, config, rest) {
3291
3292
  if (code !== 0) process.exitCode = code;
3292
3293
  }
3293
3294
  async function repl(client, config, opts = {}) {
3294
- if (!config.token) {
3295
- console.log(c.yellow("Not logged in. Run `clixad login` first.\n"));
3296
- return;
3297
- }
3298
3295
  if (opts.resume === "pick") {
3299
3296
  const sessions = listSessions(void 0, 10);
3300
3297
  if (!sessions.length) return console.log(c.yellow("no saved sessions yet"));
@@ -3306,9 +3303,18 @@ async function repl(client, config, opts = {}) {
3306
3303
  return;
3307
3304
  }
3308
3305
  if (!process.stdin.isTTY) {
3306
+ if (!config.token) {
3307
+ console.log(c.yellow("Not logged in, and interactive mode needs a terminal."));
3308
+ console.log(c.dim(' Run `clixad login` in a terminal, then `clixad -p "..."` for scripted runs.'));
3309
+ return;
3310
+ }
3309
3311
  console.log(c.yellow('Interactive mode needs a terminal. Use `clixad -p "..."` for scripted runs.'));
3310
3312
  return;
3311
3313
  }
3314
+ if (!config.token) {
3315
+ await login(client, config, []);
3316
+ if (!config.token) return;
3317
+ }
3312
3318
  let session;
3313
3319
  if (opts.resume === "latest") {
3314
3320
  session = latestSession(process.cwd());
@@ -3372,7 +3378,7 @@ function printHelp() {
3372
3378
  ${c.cyan("--continue")} resume the last session in this directory
3373
3379
  ${c.cyan("--resume")} [id] list saved sessions, or resume one
3374
3380
  ${c.cyan("--version")} print the version and exit
3375
- (no command) interactive coding REPL`);
3381
+ (no command) interactive coding REPL ${c.dim("(signs you in if needed)")}`);
3376
3382
  }
3377
3383
  main().catch((err) => {
3378
3384
  console.error(c.red(err.message));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clixad",
3
- "version": "0.0.1-beta.4",
3
+ "version": "0.0.1-beta.5",
4
4
  "description": "Free AI coding agent in your terminal, funded by rewarded ads.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",