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.
- package/dist/commands/card.js +12 -30
- package/package.json +1 -1
- package/src/commands/card.ts +12 -34
package/dist/commands/card.js
CHANGED
|
@@ -145,49 +145,31 @@ function registerCardCommands(program) {
|
|
|
145
145
|
});
|
|
146
146
|
card
|
|
147
147
|
.command("configure")
|
|
148
|
-
.description("
|
|
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(
|
|
156
|
-
|
|
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(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
package/src/commands/card.ts
CHANGED
|
@@ -195,55 +195,33 @@ export function registerCardCommands(program: Command): void {
|
|
|
195
195
|
|
|
196
196
|
card
|
|
197
197
|
.command("configure")
|
|
198
|
-
.description("
|
|
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(
|
|
206
|
-
|
|
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(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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);
|