clawmoney 0.15.21 → 0.15.22

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.
@@ -5,7 +5,8 @@ import { join } from "node:path";
5
5
  import { intro, outro, multiselect, confirm, select, spinner, isCancel, cancel, log, } from "@clack/prompts";
6
6
  import chalk from "chalk";
7
7
  import { apiPost } from "../utils/api.js";
8
- import { requireConfig } from "../utils/config.js";
8
+ import { loadConfig, requireConfig } from "../utils/config.js";
9
+ import { setupCommand } from "./setup.js";
9
10
  import { API_PRICES, RELAY_DISCOUNT, PLATFORM_FEE } from "../relay/pricing.js";
10
11
  // ── Per-cli_type model catalogs ──
11
12
  //
@@ -129,6 +130,27 @@ function formatBuyerPrice(input, output) {
129
130
  }
130
131
  // ── Main command ──
131
132
  export async function relaySetupCommand() {
133
+ // ── Step 0: ensure the agent is logged in ──
134
+ //
135
+ // Relay setup relies on an ACTIVE ClawMoney agent (api_key + agent_id
136
+ // in ~/.clawmoney/config.yaml) to register provider rows and to auth
137
+ // the daemon's WS connection. If the user runs `clawmoney relay setup`
138
+ // before ever running `clawmoney setup`, we inline the login flow
139
+ // here instead of throwing a raw "No config found" error. The nested
140
+ // setupCommand uses its own ora/prompt UI — visually different from
141
+ // the clack wizard below, but that's acceptable since it only runs on
142
+ // the first-time-user path.
143
+ let existing = loadConfig();
144
+ if (!existing) {
145
+ console.log(chalk.yellow("\n You're not logged in yet — running `clawmoney setup` first.\n"));
146
+ await setupCommand();
147
+ existing = loadConfig();
148
+ if (!existing) {
149
+ console.log(chalk.red("\n Login did not complete. Run `clawmoney setup` manually, then re-run `clawmoney relay setup`.\n"));
150
+ process.exit(1);
151
+ }
152
+ console.log("");
153
+ }
132
154
  const config = requireConfig();
133
155
  intro(chalk.cyan(" ClawMoney Relay Setup "));
134
156
  log.message("Sell your spare Claude Max / ChatGPT Pro / Google subscription capacity to other AI agents.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawmoney",
3
- "version": "0.15.21",
3
+ "version": "0.15.22",
4
4
  "description": "ClawMoney CLI -- Earn rewards with your AI agent",
5
5
  "type": "module",
6
6
  "bin": {