agentspend 0.1.9 → 0.1.10

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.
@@ -145,49 +145,31 @@ function registerCardCommands(program) {
145
145
  });
146
146
  card
147
147
  .command("configure")
148
- .description("Set up or reconfigure your card — opens the configuration page in your browser")
148
+ .description("Get configuration URL to set up or reconfigure your card")
149
149
  .action(async () => {
150
150
  try {
151
151
  // Check if card.json exists — reconfigure flow
152
152
  const cardData = await readCardFile();
153
153
  if (cardData) {
154
154
  const result = await requestConfigure(cardData.card_id, cardData.card_secret);
155
- console.log("Opened configuration page in browser.");
156
- openUrl(result.configure_url);
155
+ console.log(`Configuration URL: ${result.configure_url}`);
156
+ console.log();
157
+ console.log("Open this URL in your browser to reconfigure (change weekly limit, swap card, or remove).");
157
158
  return;
158
159
  }
159
160
  // First-time setup flow
160
161
  const result = await createCard();
161
- console.log(`Setup ID: ${result.setup_id}`);
162
- console.log(`Opening configuration page in browser...`);
163
- openUrl(result.setup_url);
164
162
  await ensureConfigDir();
165
163
  await (0, promises_1.writeFile)(SETUP_FILE, JSON.stringify({ setup_id: result.setup_id }, null, 2));
166
164
  await (0, promises_1.chmod)(SETUP_FILE, 0o600);
167
- console.log("Waiting for setup to complete...");
168
- while (true) {
169
- await sleep(3000);
170
- const status = await getSetupStatus(result.setup_id);
171
- if (status.status === "ready") {
172
- console.log(`Card is ready!`);
173
- if (status.card_id) {
174
- await (0, promises_1.writeFile)(CARD_FILE, JSON.stringify({
175
- card_id: status.card_id,
176
- card_secret: status.card_secret,
177
- }, null, 2));
178
- await (0, promises_1.chmod)(CARD_FILE, 0o600);
179
- console.log(`Card ID saved to ${CARD_FILE}`);
180
- }
181
- // Clean up setup file
182
- await (0, promises_1.unlink)(SETUP_FILE).catch(() => { });
183
- break;
184
- }
185
- if (status.status === "expired" || status.status === "failed") {
186
- await (0, promises_1.unlink)(SETUP_FILE).catch(() => { });
187
- throw new Error(`Setup ${status.status}. Please try again.`);
188
- }
189
- process.stdout.write(".");
190
- }
165
+ console.log(`Configuration URL: ${result.setup_url}`);
166
+ console.log(`Expires: ${result.expires_at}`);
167
+ console.log();
168
+ console.log("Complete setup in your browser:");
169
+ console.log(" 1. Set your weekly spending limit");
170
+ console.log(" 2. Add your card via Stripe");
171
+ console.log();
172
+ console.log("Then run 'agentspend card status' to verify completion.");
191
173
  }
192
174
  catch (err) {
193
175
  console.error(`\nError: ${err instanceof Error ? err.message : err}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentspend",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "CLI for AgentSpend — manage cards and crypto wallets for AI agent payments",
5
5
  "homepage": "https://github.com/jpbonch/agentspend",
6
6
  "license": "MIT",
@@ -195,55 +195,33 @@ export function registerCardCommands(program: Command): void {
195
195
 
196
196
  card
197
197
  .command("configure")
198
- .description("Set up or reconfigure your card — opens the configuration page in your browser")
198
+ .description("Get configuration URL to set up or reconfigure your card")
199
199
  .action(async () => {
200
200
  try {
201
201
  // Check if card.json exists — reconfigure flow
202
202
  const cardData = await readCardFile();
203
203
  if (cardData) {
204
204
  const result = await requestConfigure(cardData.card_id, cardData.card_secret);
205
- console.log("Opened configuration page in browser.");
206
- openUrl(result.configure_url);
205
+ console.log(`Configuration URL: ${result.configure_url}`);
206
+ console.log();
207
+ console.log("Open this URL in your browser to reconfigure (change weekly limit, swap card, or remove).");
207
208
  return;
208
209
  }
209
210
 
210
211
  // First-time setup flow
211
212
  const result = await createCard();
212
- console.log(`Setup ID: ${result.setup_id}`);
213
- console.log(`Opening configuration page in browser...`);
214
- openUrl(result.setup_url);
215
-
216
213
  await ensureConfigDir();
217
214
  await writeFile(SETUP_FILE, JSON.stringify({ setup_id: result.setup_id }, null, 2));
218
215
  await chmod(SETUP_FILE, 0o600);
219
216
 
220
- console.log("Waiting for setup to complete...");
221
- while (true) {
222
- await sleep(3000);
223
- const status = await getSetupStatus(result.setup_id);
224
-
225
- if (status.status === "ready") {
226
- console.log(`Card is ready!`);
227
- if (status.card_id) {
228
- await writeFile(CARD_FILE, JSON.stringify({
229
- card_id: status.card_id,
230
- card_secret: status.card_secret,
231
- }, null, 2));
232
- await chmod(CARD_FILE, 0o600);
233
- console.log(`Card ID saved to ${CARD_FILE}`);
234
- }
235
- // Clean up setup file
236
- await unlink(SETUP_FILE).catch(() => {});
237
- break;
238
- }
239
-
240
- if (status.status === "expired" || status.status === "failed") {
241
- await unlink(SETUP_FILE).catch(() => {});
242
- throw new Error(`Setup ${status.status}. Please try again.`);
243
- }
244
-
245
- process.stdout.write(".");
246
- }
217
+ console.log(`Configuration URL: ${result.setup_url}`);
218
+ console.log(`Expires: ${result.expires_at}`);
219
+ console.log();
220
+ console.log("Complete setup in your browser:");
221
+ console.log(" 1. Set your weekly spending limit");
222
+ console.log(" 2. Add your card via Stripe");
223
+ console.log();
224
+ console.log("Then run 'agentspend card status' to verify completion.");
247
225
  } catch (err: unknown) {
248
226
  console.error(`\nError: ${err instanceof Error ? err.message : err}`);
249
227
  process.exit(1);