@conto_finance/create-conto-agent 0.1.0
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/bin/conto.js +2 -0
- package/bin/create-conto-agent.js +2 -0
- package/dist/chunk-6TRDZ4JG.js +98 -0
- package/dist/chunk-M7X7S5QC.js +777 -0
- package/dist/chunk-QGM4M3NI.js +37 -0
- package/dist/chunk-X7AY7G2E.js +439 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1228 -0
- package/dist/config-63WIUTLL.js +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +34 -0
- package/dist/output-6522BGYZ.js +33 -0
- package/package.json +56 -0
package/bin/conto.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/lib/output.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import Table from "cli-table3";
|
|
4
|
+
var jsonMode = false;
|
|
5
|
+
function setJsonMode(enabled) {
|
|
6
|
+
jsonMode = enabled;
|
|
7
|
+
}
|
|
8
|
+
function isJsonMode() {
|
|
9
|
+
return jsonMode;
|
|
10
|
+
}
|
|
11
|
+
function printJson(data) {
|
|
12
|
+
console.log(JSON.stringify(data, null, 2));
|
|
13
|
+
}
|
|
14
|
+
function printHeader(text) {
|
|
15
|
+
if (jsonMode) return;
|
|
16
|
+
console.log(`
|
|
17
|
+
${chalk.bold(text)}`);
|
|
18
|
+
}
|
|
19
|
+
function printSuccess(text) {
|
|
20
|
+
if (jsonMode) return;
|
|
21
|
+
console.log(chalk.green(` \u2713 ${text}`));
|
|
22
|
+
}
|
|
23
|
+
function printError(text) {
|
|
24
|
+
if (jsonMode) return;
|
|
25
|
+
console.error(chalk.red(` \u2717 ${text}`));
|
|
26
|
+
}
|
|
27
|
+
function printWarning(text) {
|
|
28
|
+
if (jsonMode) return;
|
|
29
|
+
console.log(chalk.yellow(` \u26A0 ${text}`));
|
|
30
|
+
}
|
|
31
|
+
function printInfo(text) {
|
|
32
|
+
if (jsonMode) return;
|
|
33
|
+
console.log(chalk.dim(` ${text}`));
|
|
34
|
+
}
|
|
35
|
+
function printPending(text) {
|
|
36
|
+
if (jsonMode) return;
|
|
37
|
+
console.log(chalk.cyan(` \u23F3 ${text}`));
|
|
38
|
+
}
|
|
39
|
+
function printKeyValue(key, value) {
|
|
40
|
+
if (jsonMode) return;
|
|
41
|
+
console.log(` ${chalk.dim(key + ":")} ${value ?? chalk.dim("\u2014")}`);
|
|
42
|
+
}
|
|
43
|
+
function printTable(headers, rows, options) {
|
|
44
|
+
if (jsonMode) return;
|
|
45
|
+
const table = new Table({
|
|
46
|
+
head: headers.map((h) => chalk.bold(h)),
|
|
47
|
+
style: {
|
|
48
|
+
head: [],
|
|
49
|
+
border: [],
|
|
50
|
+
compact: options?.compact
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
for (const row of rows) {
|
|
54
|
+
table.push(row.map(String));
|
|
55
|
+
}
|
|
56
|
+
console.log(table.toString());
|
|
57
|
+
}
|
|
58
|
+
function printAmount(amount, currency) {
|
|
59
|
+
if (currency === "pathUSD" || currency === "USDC") {
|
|
60
|
+
return `$${amount.toFixed(2)} ${currency}`;
|
|
61
|
+
}
|
|
62
|
+
return `${amount} ${currency}`;
|
|
63
|
+
}
|
|
64
|
+
function truncateAddress(address, chars = 6) {
|
|
65
|
+
if (address.length <= chars * 2 + 2) return address;
|
|
66
|
+
return `${address.slice(0, chars + 2)}...${address.slice(-chars)}`;
|
|
67
|
+
}
|
|
68
|
+
function printBanner() {
|
|
69
|
+
if (jsonMode) return;
|
|
70
|
+
console.log(
|
|
71
|
+
chalk.bold(`
|
|
72
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
73
|
+
\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557
|
|
74
|
+
\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551
|
|
75
|
+
\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551
|
|
76
|
+
\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
77
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D
|
|
78
|
+
`)
|
|
79
|
+
);
|
|
80
|
+
console.log(chalk.dim(" Agentic Payments Control Center\n"));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
setJsonMode,
|
|
85
|
+
isJsonMode,
|
|
86
|
+
printJson,
|
|
87
|
+
printHeader,
|
|
88
|
+
printSuccess,
|
|
89
|
+
printError,
|
|
90
|
+
printWarning,
|
|
91
|
+
printInfo,
|
|
92
|
+
printPending,
|
|
93
|
+
printKeyValue,
|
|
94
|
+
printTable,
|
|
95
|
+
printAmount,
|
|
96
|
+
truncateAddress,
|
|
97
|
+
printBanner
|
|
98
|
+
};
|