@conto_finance/create-conto-agent 0.1.1 → 0.1.2
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/cli.js +77 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -699,11 +699,11 @@ async function policiesCommand(subcommand = "list", idOrAmount, extra) {
|
|
|
699
699
|
process.exit(1);
|
|
700
700
|
}
|
|
701
701
|
return await removeRule(api, idOrAmount, extra);
|
|
702
|
+
case "help":
|
|
703
|
+
return printPolicyHelp();
|
|
702
704
|
default:
|
|
703
705
|
printError(`Unknown subcommand: ${subcommand}`);
|
|
704
|
-
printInfo(
|
|
705
|
-
"Available: list, all, create, update <id>, delete <id>, assign <id>, unassign <id>, add-rule <id>, remove-rule <policyId> <ruleId>"
|
|
706
|
-
);
|
|
706
|
+
printInfo('Run "conto policies help" for usage guide');
|
|
707
707
|
process.exit(1);
|
|
708
708
|
}
|
|
709
709
|
} catch (err) {
|
|
@@ -956,6 +956,66 @@ async function promptForRule(policyType) {
|
|
|
956
956
|
action
|
|
957
957
|
};
|
|
958
958
|
}
|
|
959
|
+
function printPolicyHelp() {
|
|
960
|
+
console.log(chalk3.bold("\n Conto Policy Management\n"));
|
|
961
|
+
console.log(chalk3.bold(" Commands:"));
|
|
962
|
+
console.log(" conto policies List agent policies");
|
|
963
|
+
console.log(" conto policies all List all org policies");
|
|
964
|
+
console.log(" conto policies create Create a new policy");
|
|
965
|
+
console.log(" conto policies update <id> Update name/priority/status");
|
|
966
|
+
console.log(" conto policies delete <id> Delete a policy");
|
|
967
|
+
console.log(" conto policies assign <id> Assign to current agent");
|
|
968
|
+
console.log(" conto policies unassign <id> Remove from agent");
|
|
969
|
+
console.log(" conto policies add-rule <id> Add a rule");
|
|
970
|
+
console.log(" conto policies remove-rule <id> <rid> Remove a rule");
|
|
971
|
+
console.log(" conto policies help This help page");
|
|
972
|
+
console.log(chalk3.bold("\n Policy Types:"));
|
|
973
|
+
for (const pt of POLICY_TYPES) {
|
|
974
|
+
console.log(` ${chalk3.cyan(pt.value.padEnd(22))} ${chalk3.dim(pt.hint)}`);
|
|
975
|
+
}
|
|
976
|
+
console.log(chalk3.bold("\n Common Rule Types:"));
|
|
977
|
+
const commonRules = [
|
|
978
|
+
["MAX_AMOUNT", "Max per-transaction amount (e.g. 500)"],
|
|
979
|
+
["DAILY_LIMIT", "Max total spend per day (e.g. 1000)"],
|
|
980
|
+
["WEEKLY_LIMIT", "Max total spend per week"],
|
|
981
|
+
["MONTHLY_LIMIT", "Max total spend per month"],
|
|
982
|
+
["REQUIRE_APPROVAL_ABOVE", "Human approval above $ amount"],
|
|
983
|
+
["ALLOWED_COUNTERPARTIES", "JSON array of allowed addresses"],
|
|
984
|
+
["BLOCKED_COUNTERPARTIES", "JSON array of blocked addresses"],
|
|
985
|
+
["GEOGRAPHIC_RESTRICTION", "JSON array of blocked country codes"],
|
|
986
|
+
["VELOCITY_LIMIT", "Max transactions per time window"],
|
|
987
|
+
["DATE_RANGE", 'JSON: {"start":"2025-01-01","end":"2025-12-31"}']
|
|
988
|
+
];
|
|
989
|
+
for (const [rule, desc] of commonRules) {
|
|
990
|
+
console.log(` ${chalk3.cyan(rule.padEnd(28))} ${chalk3.dim(desc)}`);
|
|
991
|
+
}
|
|
992
|
+
console.log(chalk3.bold("\n Value Examples:"));
|
|
993
|
+
console.log(" Spend limits: 500");
|
|
994
|
+
console.log(' Address lists: ["0xabc...","0xdef..."]');
|
|
995
|
+
console.log(' Country codes: ["CU","IR","KP","SY","RU"]');
|
|
996
|
+
console.log(" Trust score: 50 (0-100)");
|
|
997
|
+
console.log(' Date range: {"start":"2025-01-01","end":"2025-12-31"}');
|
|
998
|
+
console.log(' Categories: ["API_PROVIDER","CLOUD","SAAS"]');
|
|
999
|
+
console.log(chalk3.bold("\n Operators:"));
|
|
1000
|
+
console.log(" LTE (<= at most) GTE (>= at least) EQUALS NOT_EQUALS");
|
|
1001
|
+
console.log(" IN_LIST NOT_IN_LIST BETWEEN DENY");
|
|
1002
|
+
console.log(chalk3.bold("\n Actions:"));
|
|
1003
|
+
console.log(` ${chalk3.green("ALLOW")} Payment proceeds if rule passes`);
|
|
1004
|
+
console.log(` ${chalk3.red("DENY")} Payment is blocked`);
|
|
1005
|
+
console.log(` ${chalk3.yellow("REQUIRE_APPROVAL")} Payment needs human approval`);
|
|
1006
|
+
console.log(chalk3.bold("\n Examples:"));
|
|
1007
|
+
console.log(chalk3.dim(" # Create a $500/day spend limit"));
|
|
1008
|
+
console.log(" conto policies create");
|
|
1009
|
+
console.log(chalk3.dim(" # Add a weekly limit rule to an existing policy"));
|
|
1010
|
+
console.log(" conto policies add-rule cmn4abc123");
|
|
1011
|
+
console.log(chalk3.dim(" # Deactivate a policy without deleting"));
|
|
1012
|
+
console.log(" conto policies update cmn4abc123");
|
|
1013
|
+
console.log(chalk3.dim(" # View all policies as JSON"));
|
|
1014
|
+
console.log(" conto policies all --json");
|
|
1015
|
+
console.log(`
|
|
1016
|
+
${chalk3.dim("Full docs: https://docs.conto.finance/cli/policies")}
|
|
1017
|
+
`);
|
|
1018
|
+
}
|
|
959
1019
|
function formatRuleValue(ruleType, value) {
|
|
960
1020
|
if (ruleType.includes("LIMIT") || ruleType.includes("AMOUNT") || ruleType.includes("CAP")) {
|
|
961
1021
|
const num = Number(value);
|
|
@@ -1224,4 +1284,18 @@ program.command("logout").description("Clear stored credentials").action(async (
|
|
|
1224
1284
|
printSuccess3("Logged out. Credentials cleared.");
|
|
1225
1285
|
});
|
|
1226
1286
|
program.command("mcp").description("Start MCP server for AI agent integration").action(mcpCommand);
|
|
1287
|
+
program.command("docs [topic]").description("Open Conto documentation (cli, policies, sdk, api)").action(async (topic) => {
|
|
1288
|
+
const open = (await import("open")).default;
|
|
1289
|
+
const urls = {
|
|
1290
|
+
cli: "https://docs.conto.finance/cli/quickstart",
|
|
1291
|
+
policies: "https://docs.conto.finance/cli/policies",
|
|
1292
|
+
commands: "https://docs.conto.finance/cli/commands",
|
|
1293
|
+
sdk: "https://docs.conto.finance/sdk/installation",
|
|
1294
|
+
api: "https://docs.conto.finance/api"
|
|
1295
|
+
};
|
|
1296
|
+
const url = urls[topic || "cli"] || urls.cli;
|
|
1297
|
+
const { printInfo: printInfo3 } = await import("./output-VT23PY74.js");
|
|
1298
|
+
printInfo3(`Opening ${url}`);
|
|
1299
|
+
open(url);
|
|
1300
|
+
});
|
|
1227
1301
|
program.parse();
|