httpcat-cli 0.3.0-rc.9 → 0.3.1

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 (203) hide show
  1. package/.github/workflows/ci.yml +3 -0
  2. package/.github/workflows/rc-publish.yml +6 -0
  3. package/.github/workflows/release.yml +6 -0
  4. package/README.md +1306 -130
  5. package/bun.lock +2 -2
  6. package/dist/agent/ax-agent.d.ts.map +1 -1
  7. package/dist/agent/ax-agent.js +64 -1
  8. package/dist/agent/ax-agent.js.map +1 -1
  9. package/dist/agent/tools.d.ts.map +1 -1
  10. package/dist/agent/tools.js +107 -7
  11. package/dist/agent/tools.js.map +1 -1
  12. package/dist/client.d.ts.map +1 -1
  13. package/dist/client.js +258 -11
  14. package/dist/client.js.map +1 -1
  15. package/dist/commands/account.d.ts.map +1 -1
  16. package/dist/commands/account.js +34 -14
  17. package/dist/commands/account.js.map +1 -1
  18. package/dist/commands/agent.d.ts.map +1 -1
  19. package/dist/commands/agent.js +114 -247
  20. package/dist/commands/agent.js.map +1 -1
  21. package/dist/commands/approve.d.ts.map +1 -0
  22. package/dist/commands/approve.js +505 -0
  23. package/dist/commands/approve.js.map +1 -0
  24. package/dist/commands/automation.d.ts.map +1 -0
  25. package/dist/commands/automation.js +346 -0
  26. package/dist/commands/automation.js.map +1 -0
  27. package/dist/commands/balances.d.ts.map +1 -1
  28. package/dist/commands/balances.js +31 -8
  29. package/dist/commands/balances.js.map +1 -1
  30. package/dist/commands/buy.d.ts.map +1 -1
  31. package/dist/commands/buy.js +88 -115
  32. package/dist/commands/buy.js.map +1 -1
  33. package/dist/commands/call.d.ts.map +1 -0
  34. package/dist/commands/call.js +51 -0
  35. package/dist/commands/call.js.map +1 -0
  36. package/dist/commands/cex.d.ts.map +1 -0
  37. package/dist/commands/cex.js +958 -0
  38. package/dist/commands/cex.js.map +1 -0
  39. package/dist/commands/claim.d.ts.map +1 -1
  40. package/dist/commands/claim.js +231 -4
  41. package/dist/commands/claim.js.map +1 -1
  42. package/dist/commands/create.d.ts.map +1 -1
  43. package/dist/commands/create.js +88 -3
  44. package/dist/commands/create.js.map +1 -1
  45. package/dist/commands/gasless-swap.d.ts.map +1 -0
  46. package/dist/commands/gasless-swap.js +232 -0
  47. package/dist/commands/gasless-swap.js.map +1 -0
  48. package/dist/commands/health.d.ts.map +1 -1
  49. package/dist/commands/health.js +58 -4
  50. package/dist/commands/health.js.map +1 -1
  51. package/dist/commands/info.js +1 -1
  52. package/dist/commands/info.js.map +1 -1
  53. package/dist/commands/launchpad.d.ts.map +1 -0
  54. package/dist/commands/launchpad.js +708 -0
  55. package/dist/commands/launchpad.js.map +1 -0
  56. package/dist/commands/list.d.ts.map +1 -1
  57. package/dist/commands/list.js +1 -1
  58. package/dist/commands/list.js.map +1 -1
  59. package/dist/commands/market.d.ts.map +1 -0
  60. package/dist/commands/market.js +960 -0
  61. package/dist/commands/market.js.map +1 -0
  62. package/dist/commands/mcp-install.d.ts.map +1 -0
  63. package/dist/commands/mcp-install.js +387 -0
  64. package/dist/commands/mcp-install.js.map +1 -0
  65. package/dist/commands/opps.d.ts.map +1 -0
  66. package/dist/commands/opps.js +409 -0
  67. package/dist/commands/opps.js.map +1 -0
  68. package/dist/commands/perps.d.ts.map +1 -0
  69. package/dist/commands/perps.js +248 -0
  70. package/dist/commands/perps.js.map +1 -0
  71. package/dist/commands/portfolio.d.ts.map +1 -0
  72. package/dist/commands/portfolio.js +679 -0
  73. package/dist/commands/portfolio.js.map +1 -0
  74. package/dist/commands/positions.js +1 -1
  75. package/dist/commands/positions.js.map +1 -1
  76. package/dist/commands/predict.d.ts.map +1 -0
  77. package/dist/commands/predict.js +280 -0
  78. package/dist/commands/predict.js.map +1 -0
  79. package/dist/commands/predictions.d.ts.map +1 -0
  80. package/dist/commands/predictions.js +486 -0
  81. package/dist/commands/predictions.js.map +1 -0
  82. package/dist/commands/risk.d.ts.map +1 -0
  83. package/dist/commands/risk.js +225 -0
  84. package/dist/commands/risk.js.map +1 -0
  85. package/dist/commands/security.d.ts.map +1 -0
  86. package/dist/commands/security.js +244 -0
  87. package/dist/commands/security.js.map +1 -0
  88. package/dist/commands/sell.js +3 -3
  89. package/dist/commands/sell.js.map +1 -1
  90. package/dist/commands/send.d.ts.map +1 -0
  91. package/dist/commands/send.js +733 -0
  92. package/dist/commands/send.js.map +1 -0
  93. package/dist/commands/sign.d.ts.map +1 -0
  94. package/dist/commands/sign.js +1048 -0
  95. package/dist/commands/sign.js.map +1 -0
  96. package/dist/commands/swap.d.ts.map +1 -1
  97. package/dist/commands/swap.js +245 -2
  98. package/dist/commands/swap.js.map +1 -1
  99. package/dist/commands/system.d.ts.map +1 -0
  100. package/dist/commands/system.js +417 -0
  101. package/dist/commands/system.js.map +1 -0
  102. package/dist/commands/tools/index.d.ts.map +1 -0
  103. package/dist/commands/tools/index.js +2040 -0
  104. package/dist/commands/tools/index.js.map +1 -0
  105. package/dist/commands/trade.d.ts.map +1 -0
  106. package/dist/commands/trade.js +237 -0
  107. package/dist/commands/trade.js.map +1 -0
  108. package/dist/commands/transactions.js +1 -1
  109. package/dist/commands/transactions.js.map +1 -1
  110. package/dist/commands/update.d.ts.map +1 -0
  111. package/dist/commands/update.js +429 -0
  112. package/dist/commands/update.js.map +1 -0
  113. package/dist/config.d.ts.map +1 -1
  114. package/dist/config.js +91 -9
  115. package/dist/config.js.map +1 -1
  116. package/dist/index.js +4409 -1050
  117. package/dist/index.js.map +1 -1
  118. package/dist/interactive/art.d.ts.map +1 -1
  119. package/dist/interactive/art.js +33 -0
  120. package/dist/interactive/art.js.map +1 -1
  121. package/dist/interactive/shell.d.ts.map +1 -1
  122. package/dist/interactive/shell.js +81 -5
  123. package/dist/interactive/shell.js.map +1 -1
  124. package/dist/mcp/context.d.ts.map +1 -0
  125. package/dist/mcp/context.js +211 -0
  126. package/dist/mcp/context.js.map +1 -0
  127. package/dist/mcp/onboarding.d.ts.map +1 -0
  128. package/dist/mcp/onboarding.js +266 -0
  129. package/dist/mcp/onboarding.js.map +1 -0
  130. package/dist/mcp/resources.d.ts.map +1 -0
  131. package/dist/mcp/resources.js +222 -0
  132. package/dist/mcp/resources.js.map +1 -0
  133. package/dist/mcp/server.d.ts.map +1 -1
  134. package/dist/mcp/server.js +51 -1
  135. package/dist/mcp/server.js.map +1 -1
  136. package/dist/mcp/tools.d.ts.map +1 -1
  137. package/dist/mcp/tools.js +4119 -169
  138. package/dist/mcp/tools.js.map +1 -1
  139. package/dist/mcp/types.d.ts.map +1 -1
  140. package/dist/ui/components/shell/ShellInput.d.ts.map +1 -1
  141. package/dist/ui/components/shell/ShellInput.js +4 -0
  142. package/dist/ui/components/shell/ShellInput.js.map +1 -1
  143. package/dist/utils/admin.d.ts.map +1 -0
  144. package/dist/utils/admin.js +144 -0
  145. package/dist/utils/admin.js.map +1 -0
  146. package/dist/utils/autoSetup.d.ts.map +1 -0
  147. package/dist/utils/autoSetup.js +252 -0
  148. package/dist/utils/autoSetup.js.map +1 -0
  149. package/dist/utils/build-constants.d.ts.map +1 -0
  150. package/dist/utils/build-constants.js +10 -0
  151. package/dist/utils/build-constants.js.map +1 -0
  152. package/dist/utils/errors.d.ts.map +1 -1
  153. package/dist/utils/errors.js +10 -1
  154. package/dist/utils/errors.js.map +1 -1
  155. package/dist/utils/formatting.d.ts.map +1 -1
  156. package/dist/utils/formatting.js +9 -3
  157. package/dist/utils/formatting.js.map +1 -1
  158. package/dist/utils/llm-cli-config.d.ts.map +1 -0
  159. package/dist/utils/llm-cli-config.js +963 -0
  160. package/dist/utils/llm-cli-config.js.map +1 -0
  161. package/dist/utils/llm-cli-detector.d.ts.map +1 -0
  162. package/dist/utils/llm-cli-detector.js +202 -0
  163. package/dist/utils/llm-cli-detector.js.map +1 -0
  164. package/dist/utils/maintenance.d.ts.map +1 -0
  165. package/dist/utils/maintenance.js +17 -0
  166. package/dist/utils/maintenance.js.map +1 -0
  167. package/dist/utils/mcp-config.d.ts.map +1 -0
  168. package/dist/utils/mcp-config.js +77 -0
  169. package/dist/utils/mcp-config.js.map +1 -0
  170. package/dist/utils/privateKeyPrompt.d.ts.map +1 -1
  171. package/dist/utils/privateKeyPrompt.js +287 -119
  172. package/dist/utils/privateKeyPrompt.js.map +1 -1
  173. package/dist/utils/process-cleanup.d.ts.map +1 -0
  174. package/dist/utils/process-cleanup.js +136 -0
  175. package/dist/utils/process-cleanup.js.map +1 -0
  176. package/dist/utils/retry.d.ts.map +1 -0
  177. package/dist/utils/retry.js +56 -0
  178. package/dist/utils/retry.js.map +1 -0
  179. package/dist/utils/shell-setup.d.ts.map +1 -0
  180. package/dist/utils/shell-setup.js +531 -0
  181. package/dist/utils/shell-setup.js.map +1 -0
  182. package/dist/utils/token-resolver.d.ts.map +1 -1
  183. package/dist/utils/token-resolver.js +42 -0
  184. package/dist/utils/token-resolver.js.map +1 -1
  185. package/dist/utils/x402-caller.d.ts.map +1 -0
  186. package/dist/utils/x402-caller.js +17 -0
  187. package/dist/utils/x402-caller.js.map +1 -0
  188. package/docs/README.md +28 -0
  189. package/docs/agent/README.md +18 -0
  190. package/docs/api/README.md +41 -0
  191. package/docs/cli/README.md +42 -0
  192. package/docs/guides/README.md +26 -0
  193. package/docs/implementation/README.md +18 -0
  194. package/docs/planning/README.md +19 -0
  195. package/docs/testing/README.md +15 -0
  196. package/docs/ux/README.md +16 -0
  197. package/package.json +9 -3
  198. package/scripts/cat-spin.sh +417 -0
  199. package/scripts/deprecate-rc-versions.js +58 -0
  200. package/scripts/inject-build-constants.js +43 -0
  201. package/scripts/monitor-foobar.js +117 -0
  202. package/test.txt +12 -0
  203. package/tests/fixtures/test-data.json +16 -0
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Deprecate all RC versions on npm
4
+ * This marks them as deprecated but doesn't remove them
5
+ */
6
+
7
+ import { execSync } from 'child_process';
8
+
9
+ const PACKAGE_NAME = 'httpcat-cli';
10
+ const DEPRECATION_MESSAGE = 'This RC version has been deprecated. Please use the latest release version.';
11
+
12
+ async function deprecateRcVersions() {
13
+ try {
14
+ console.log('Fetching all versions from npm...');
15
+ const versionsJson = execSync(`npm view ${PACKAGE_NAME} versions --json`, { encoding: 'utf-8' });
16
+ const allVersions = JSON.parse(versionsJson);
17
+
18
+ // Filter for RC versions
19
+ const rcVersions = allVersions.filter((v) => v.includes('-rc.'));
20
+
21
+ console.log(`Found ${rcVersions.length} RC versions to deprecate\n`);
22
+
23
+ if (rcVersions.length === 0) {
24
+ console.log('No RC versions found.');
25
+ return;
26
+ }
27
+
28
+ // Deprecate each RC version
29
+ let successCount = 0;
30
+ let failCount = 0;
31
+
32
+ for (const version of rcVersions) {
33
+ try {
34
+ console.log(`Deprecating ${version}...`);
35
+ execSync(
36
+ `npm deprecate ${PACKAGE_NAME}@${version} "${DEPRECATION_MESSAGE}"`,
37
+ { stdio: 'inherit' }
38
+ );
39
+ successCount++;
40
+ // Small delay to avoid rate limiting
41
+ await new Promise((resolve) => setTimeout(resolve, 100));
42
+ } catch (error) {
43
+ console.error(`Failed to deprecate ${version}:`, error.message);
44
+ failCount++;
45
+ }
46
+ }
47
+
48
+ console.log(`\nāœ… Deprecated ${successCount} RC versions`);
49
+ if (failCount > 0) {
50
+ console.log(`āš ļø Failed to deprecate ${failCount} RC versions`);
51
+ }
52
+ } catch (error) {
53
+ console.error('Error:', error.message);
54
+ process.exit(1);
55
+ }
56
+ }
57
+
58
+ deprecateRcVersions();
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Build-time script to inject environment variables into build-constants.ts
4
+ * This bakes the values directly into the compiled code.
5
+ */
6
+
7
+ import { readFileSync, writeFileSync } from 'fs';
8
+ import { join, dirname } from 'path';
9
+ import { fileURLToPath } from 'url';
10
+
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
13
+ const rootDir = join(__dirname, '..');
14
+ const constantsFile = join(rootDir, 'src', 'utils', 'build-constants.ts');
15
+
16
+ // Get values from environment variables
17
+ const authorizedWallets = process.env.AUTHORIZED_WALLETS || '';
18
+ const adminCommands = process.env.HTTPCAT_ADMIN_COMMANDS || '';
19
+
20
+ // Generate the constants file with actual values
21
+ const content = `/**
22
+ * Build-time constants
23
+ * These values are injected at build time from environment variables
24
+ * and baked into the compiled code.
25
+ *
26
+ * DO NOT EDIT THIS FILE MANUALLY - it is generated by scripts/inject-build-constants.js
27
+ */
28
+
29
+ ${authorizedWallets ? `export const BUILD_AUTHORIZED_WALLETS: string = ${JSON.stringify(authorizedWallets)};` : 'export const BUILD_AUTHORIZED_WALLETS: string | undefined = undefined;'}
30
+ ${adminCommands ? `export const BUILD_ADMIN_COMMANDS: string = ${JSON.stringify(adminCommands)};` : 'export const BUILD_ADMIN_COMMANDS: string | undefined = undefined;'}
31
+ `;
32
+
33
+ writeFileSync(constantsFile, content, 'utf-8');
34
+ console.log('āœ… Injected build-time constants:');
35
+ if (authorizedWallets) {
36
+ console.log(` AUTHORIZED_WALLETS: ${authorizedWallets}`);
37
+ }
38
+ if (adminCommands) {
39
+ console.log(` HTTPCAT_ADMIN_COMMANDS: ${adminCommands}`);
40
+ }
41
+ if (!authorizedWallets && !adminCommands) {
42
+ console.log(' (no build-time constants set)');
43
+ }
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Monitor FRIDA chat for mentions of "foobar"
5
+ *
6
+ * Usage:
7
+ * node monitor-foobar.js
8
+ */
9
+
10
+ import { spawn } from "child_process";
11
+ import { fileURLToPath } from "url";
12
+ import { dirname } from "path";
13
+
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = dirname(__filename);
16
+
17
+ const TOKEN = "FRIDA";
18
+ const SEARCH_TERM = "foobar";
19
+
20
+ console.error(`šŸ” Monitoring FRIDA chat for mentions of "${SEARCH_TERM}"...`);
21
+ console.error(`Press Ctrl+C to stop monitoring\n`);
22
+
23
+ // Spawn httpcat chat process
24
+ const chatProcess = spawn("httpcat", ["chat", "--json", TOKEN], {
25
+ stdio: ["pipe", "pipe", "inherit"],
26
+ shell: true,
27
+ });
28
+
29
+ let outputBuffer = "";
30
+ let seenMessageIds = new Set();
31
+
32
+ chatProcess.stdout.on("data", (data) => {
33
+ outputBuffer += data.toString();
34
+ const lines = outputBuffer.split("\n");
35
+ outputBuffer = lines.pop() || "";
36
+
37
+ for (const line of lines) {
38
+ if (!line.trim()) continue;
39
+
40
+ try {
41
+ const event = JSON.parse(line);
42
+
43
+ switch (event.type) {
44
+ case "joined":
45
+ console.error(`āœ… Joined FRIDA chat. Lease ID: ${event.leaseId}`);
46
+ console.error(`šŸ“” Monitoring for "${SEARCH_TERM}" mentions...\n`);
47
+ break;
48
+
49
+ case "message":
50
+ const msg = event.data;
51
+
52
+ // Skip if we've already seen this message
53
+ if (seenMessageIds.has(msg.messageId)) {
54
+ break;
55
+ }
56
+ seenMessageIds.add(msg.messageId);
57
+
58
+ // Check if message contains search term (case-insensitive)
59
+ if (msg.message.toLowerCase().includes(SEARCH_TERM.toLowerCase())) {
60
+ const author = msg.authorShort || msg.author?.slice(0, 10);
61
+ const time = new Date(msg.timestamp).toLocaleString();
62
+
63
+ console.error("\n" + "=".repeat(60));
64
+ console.error(`šŸŽÆ FOUND "${SEARCH_TERM}" MENTION!`);
65
+ console.error("=".repeat(60));
66
+ console.error(`Time: ${time}`);
67
+ console.error(`Author: ${author}`);
68
+ console.error(`Message: ${msg.message}`);
69
+ console.error("=".repeat(60) + "\n");
70
+ }
71
+ break;
72
+
73
+ case "lease_expired":
74
+ console.error("ā±ļø Lease expired. Sending /renew...");
75
+ if (chatProcess.stdin && !chatProcess.stdin.destroyed) {
76
+ chatProcess.stdin.write("/renew\n");
77
+ }
78
+ break;
79
+
80
+ case "error":
81
+ console.error(`āŒ Error: ${event.error}`);
82
+ break;
83
+
84
+ case "exiting":
85
+ console.error("šŸ‘‹ Chat session ended");
86
+ process.exit(0);
87
+ break;
88
+ }
89
+ } catch (error) {
90
+ // Not JSON, ignore
91
+ }
92
+ }
93
+ });
94
+
95
+ chatProcess.on("error", (error) => {
96
+ console.error(`āŒ Failed to start chat process: ${error.message}`);
97
+ process.exit(1);
98
+ });
99
+
100
+ chatProcess.on("exit", (code) => {
101
+ if (code !== 0 && code !== null) {
102
+ console.error(`Chat process exited with code ${code}`);
103
+ }
104
+ process.exit(code || 0);
105
+ });
106
+
107
+ // Handle Ctrl+C
108
+ process.on("SIGINT", () => {
109
+ console.error("\nšŸ‘‹ Stopping monitor...");
110
+ if (chatProcess.stdin && !chatProcess.stdin.destroyed) {
111
+ chatProcess.stdin.write("/exit\n");
112
+ }
113
+ setTimeout(() => {
114
+ chatProcess.kill();
115
+ process.exit(0);
116
+ }, 1000);
117
+ });
package/test.txt ADDED
@@ -0,0 +1,12 @@
1
+ config Configure httpcat (settings, environments, accounts)
2
+ (MOVE TO UNDER CONFIG) completion Generate shell completion script
3
+ launchpad 402.cat Launchpad operations (bonding curve tokens)
4
+ trade Trading operations (swaps)
5
+ system System operations and health checks
6
+ chat Start streaming chat ($0.01 to join, $0.0001 per message,
7
+ 10 min lease)
8
+ mcp-server Start MCP (Model Context Protocol) server for AI
9
+ assistant integration
10
+ use Switch account or environment (use <index> for account,
11
+ <name> for environment)
12
+ help Display help for httpcat
@@ -0,0 +1,16 @@
1
+ {
2
+ "testTokens": {
3
+ "base-sepolia": {
4
+ "usdc": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
5
+ "weth": "0x4200000000000000000000000000000000000006"
6
+ },
7
+ "base": {
8
+ "usdc": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
9
+ "weth": "0x4200000000000000000000000000000000000006"
10
+ }
11
+ },
12
+ "testMarkets": {
13
+ "btc-usd": "BTC-USD",
14
+ "eth-usd": "ETH-USD"
15
+ }
16
+ }