agentspend 0.1.7 → 0.1.9

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.
@@ -12,6 +12,7 @@ const CARD_FILE = (0, node_path_1.join)(CONFIG_DIR, "card.json");
12
12
  const API_BASE = process.env.AGENTSPEND_API_URL ?? "https://api.agentspend.co";
13
13
  async function ensureConfigDir() {
14
14
  await (0, promises_1.mkdir)(CONFIG_DIR, { recursive: true });
15
+ await (0, promises_1.chmod)(CONFIG_DIR, 0o700);
15
16
  }
16
17
  function openUrl(url) {
17
18
  const cmd = node_process_1.platform === "darwin" ? "open" : node_process_1.platform === "win32" ? "start" : "xdg-open";
@@ -162,6 +163,7 @@ function registerCardCommands(program) {
162
163
  openUrl(result.setup_url);
163
164
  await ensureConfigDir();
164
165
  await (0, promises_1.writeFile)(SETUP_FILE, JSON.stringify({ setup_id: result.setup_id }, null, 2));
166
+ await (0, promises_1.chmod)(SETUP_FILE, 0o600);
165
167
  console.log("Waiting for setup to complete...");
166
168
  while (true) {
167
169
  await sleep(3000);
@@ -173,6 +175,7 @@ function registerCardCommands(program) {
173
175
  card_id: status.card_id,
174
176
  card_secret: status.card_secret,
175
177
  }, null, 2));
178
+ await (0, promises_1.chmod)(CARD_FILE, 0o600);
176
179
  console.log(`Card ID saved to ${CARD_FILE}`);
177
180
  }
178
181
  // Clean up setup file
@@ -8,6 +8,7 @@ const CONFIG_DIR = (0, node_path_1.join)((0, node_os_1.homedir)(), ".agentspend"
8
8
  const WALLET_FILE = (0, node_path_1.join)(CONFIG_DIR, "wallet.json");
9
9
  async function ensureConfigDir() {
10
10
  await (0, promises_1.mkdir)(CONFIG_DIR, { recursive: true });
11
+ await (0, promises_1.chmod)(CONFIG_DIR, 0o700);
11
12
  }
12
13
  async function readWalletConfig() {
13
14
  try {
@@ -49,7 +50,9 @@ function registerWalletCommands(program) {
49
50
  private_key: privateKey,
50
51
  };
51
52
  await (0, promises_1.writeFile)(WALLET_FILE, JSON.stringify(config, null, 2));
53
+ await (0, promises_1.chmod)(WALLET_FILE, 0o600);
52
54
  console.log(`Wallet created. Address: ${account.address} — Fund it with USDC on Base.`);
55
+ console.log(`Private key saved to ${WALLET_FILE} (owner-only permissions). Keep this file secure.`);
53
56
  }
54
57
  catch (err) {
55
58
  console.error(`Error: ${err instanceof Error ? err.message : err}`);
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "agentspend",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "CLI for AgentSpend — manage cards and crypto wallets for AI agent payments",
5
+ "homepage": "https://github.com/jpbonch/agentspend",
6
+ "license": "MIT",
5
7
  "repository": {
6
8
  "type": "git",
7
9
  "url": "git+https://github.com/jpbonch/agentspend.git"
8
10
  },
11
+ "engines": {
12
+ "node": ">=18"
13
+ },
9
14
  "bin": {
10
15
  "agentspend": "dist/index.js"
11
16
  },
@@ -1,5 +1,5 @@
1
1
  import { Command } from "commander";
2
- import { readFile, writeFile, mkdir, unlink } from "node:fs/promises";
2
+ import { readFile, writeFile, mkdir, unlink, chmod } from "node:fs/promises";
3
3
  import { homedir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  import { exec } from "node:child_process";
@@ -42,6 +42,7 @@ const API_BASE = process.env.AGENTSPEND_API_URL ?? "https://api.agentspend.co";
42
42
 
43
43
  async function ensureConfigDir(): Promise<void> {
44
44
  await mkdir(CONFIG_DIR, { recursive: true });
45
+ await chmod(CONFIG_DIR, 0o700);
45
46
  }
46
47
 
47
48
  function openUrl(url: string): void {
@@ -214,6 +215,7 @@ export function registerCardCommands(program: Command): void {
214
215
 
215
216
  await ensureConfigDir();
216
217
  await writeFile(SETUP_FILE, JSON.stringify({ setup_id: result.setup_id }, null, 2));
218
+ await chmod(SETUP_FILE, 0o600);
217
219
 
218
220
  console.log("Waiting for setup to complete...");
219
221
  while (true) {
@@ -227,6 +229,7 @@ export function registerCardCommands(program: Command): void {
227
229
  card_id: status.card_id,
228
230
  card_secret: status.card_secret,
229
231
  }, null, 2));
232
+ await chmod(CARD_FILE, 0o600);
230
233
  console.log(`Card ID saved to ${CARD_FILE}`);
231
234
  }
232
235
  // Clean up setup file
@@ -1,5 +1,5 @@
1
1
  import { Command } from "commander";
2
- import { readFile, writeFile, mkdir } from "node:fs/promises";
2
+ import { readFile, writeFile, mkdir, chmod } from "node:fs/promises";
3
3
  import { homedir } from "node:os";
4
4
  import { join } from "node:path";
5
5
 
@@ -8,6 +8,7 @@ const WALLET_FILE = join(CONFIG_DIR, "wallet.json");
8
8
 
9
9
  async function ensureConfigDir(): Promise<void> {
10
10
  await mkdir(CONFIG_DIR, { recursive: true });
11
+ await chmod(CONFIG_DIR, 0o700);
11
12
  }
12
13
 
13
14
  interface WalletConfig {
@@ -61,8 +62,10 @@ export function registerWalletCommands(program: Command): void {
61
62
  };
62
63
 
63
64
  await writeFile(WALLET_FILE, JSON.stringify(config, null, 2));
65
+ await chmod(WALLET_FILE, 0o600);
64
66
 
65
67
  console.log(`Wallet created. Address: ${account.address} — Fund it with USDC on Base.`);
68
+ console.log(`Private key saved to ${WALLET_FILE} (owner-only permissions). Keep this file secure.`);
66
69
  } catch (err: unknown) {
67
70
  console.error(`Error: ${err instanceof Error ? err.message : err}`);
68
71
  process.exit(1);