@grimoirelabs/cli 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/dist/commands/advisor-skill-helpers.d.ts +2 -0
- package/dist/commands/advisor-skill-helpers.d.ts.map +1 -0
- package/dist/commands/advisor-skill-helpers.js +24 -0
- package/dist/commands/advisor-skill-helpers.js.map +1 -0
- package/dist/commands/cast.d.ts +26 -0
- package/dist/commands/cast.d.ts.map +1 -0
- package/dist/commands/cast.js +334 -0
- package/dist/commands/cast.js.map +1 -0
- package/dist/commands/compile-all.d.ts +11 -0
- package/dist/commands/compile-all.d.ts.map +1 -0
- package/dist/commands/compile-all.js +84 -0
- package/dist/commands/compile-all.js.map +1 -0
- package/dist/commands/compile.d.ts +11 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +63 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/history.d.ts +12 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +68 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/init.d.ts +10 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +174 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/log.d.ts +11 -0
- package/dist/commands/log.d.ts.map +1 -0
- package/dist/commands/log.js +95 -0
- package/dist/commands/log.js.map +1 -0
- package/dist/commands/simulate.d.ts +15 -0
- package/dist/commands/simulate.d.ts.map +1 -0
- package/dist/commands/simulate.js +110 -0
- package/dist/commands/simulate.js.map +1 -0
- package/dist/commands/state-helpers.d.ts +18 -0
- package/dist/commands/state-helpers.d.ts.map +1 -0
- package/dist/commands/state-helpers.js +34 -0
- package/dist/commands/state-helpers.js.map +1 -0
- package/dist/commands/validate.d.ts +10 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +67 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/venues.d.ts +10 -0
- package/dist/commands/venues.d.ts.map +1 -0
- package/dist/commands/venues.js +31 -0
- package/dist/commands/venues.js.map +1 -0
- package/dist/commands/wallet.d.ts +7 -0
- package/dist/commands/wallet.d.ts.map +1 -0
- package/dist/commands/wallet.js +437 -0
- package/dist/commands/wallet.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/package.json +27 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Grimoire CLI
|
|
4
|
+
* Command-line interface for spell management and execution
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
import { castCommand } from "./commands/cast.js";
|
|
8
|
+
import { compileAllCommand } from "./commands/compile-all.js";
|
|
9
|
+
import { compileCommand } from "./commands/compile.js";
|
|
10
|
+
import { historyCommand } from "./commands/history.js";
|
|
11
|
+
import { initCommand } from "./commands/init.js";
|
|
12
|
+
import { logCommand } from "./commands/log.js";
|
|
13
|
+
import { simulateCommand } from "./commands/simulate.js";
|
|
14
|
+
import { validateCommand } from "./commands/validate.js";
|
|
15
|
+
import { venuesCommand } from "./commands/venues.js";
|
|
16
|
+
import { walletCommand } from "./commands/wallet.js";
|
|
17
|
+
const program = new Command();
|
|
18
|
+
program
|
|
19
|
+
.name("grimoire")
|
|
20
|
+
.description("A Portable Execution Language for Onchain Strategies")
|
|
21
|
+
.version("0.1.0");
|
|
22
|
+
// Init command
|
|
23
|
+
program
|
|
24
|
+
.command("init")
|
|
25
|
+
.description("Initialize a new .grimoire directory")
|
|
26
|
+
.option("-f, --force", "Overwrite existing files")
|
|
27
|
+
.action(initCommand);
|
|
28
|
+
// Compile command
|
|
29
|
+
program
|
|
30
|
+
.command("compile <spell>")
|
|
31
|
+
.description("Compile a .spell file to IR")
|
|
32
|
+
.option("-o, --output <file>", "Output file for IR JSON")
|
|
33
|
+
.option("--pretty", "Pretty print JSON output")
|
|
34
|
+
.action(compileCommand);
|
|
35
|
+
// Compile all command
|
|
36
|
+
program
|
|
37
|
+
.command("compile-all [dir]")
|
|
38
|
+
.description("Compile all .spell files in a directory (default: spells)")
|
|
39
|
+
.option("--fail-fast", "Stop after the first failure")
|
|
40
|
+
.option("--json", "Output results as JSON")
|
|
41
|
+
.action(compileAllCommand);
|
|
42
|
+
// Validate command
|
|
43
|
+
program
|
|
44
|
+
.command("validate <spell>")
|
|
45
|
+
.description("Validate a .spell file")
|
|
46
|
+
.option("--strict", "Treat warnings as errors")
|
|
47
|
+
.action(validateCommand);
|
|
48
|
+
// Simulate command
|
|
49
|
+
program
|
|
50
|
+
.command("simulate <spell>")
|
|
51
|
+
.description("Simulate spell execution (dry run)")
|
|
52
|
+
.option("-p, --params <json>", "Parameters as JSON")
|
|
53
|
+
.option("--vault <address>", "Vault address")
|
|
54
|
+
.option("--chain <id>", "Chain ID", "1")
|
|
55
|
+
.option("--advisor-skills-dir <dir...>", "Directory to load advisor skills (default: ./skills)")
|
|
56
|
+
.option("--state-dir <dir>", "Directory for state database")
|
|
57
|
+
.option("--no-state", "Disable state persistence")
|
|
58
|
+
.action(simulateCommand);
|
|
59
|
+
// Cast command
|
|
60
|
+
program
|
|
61
|
+
.command("cast <spell>")
|
|
62
|
+
.description("Execute a spell")
|
|
63
|
+
.option("-p, --params <json>", "Parameters as JSON")
|
|
64
|
+
.option("--vault <address>", "Vault address")
|
|
65
|
+
.option("--chain <id>", "Chain ID", "1")
|
|
66
|
+
.option("--dry-run", "Simulate without executing")
|
|
67
|
+
.option("--private-key <key>", "Private key (hex) - NOT RECOMMENDED, use --key-env")
|
|
68
|
+
.option("--key-env <name>", "Environment variable containing private key")
|
|
69
|
+
.option("--keystore <path>", "Path to keystore file")
|
|
70
|
+
.option("--password-env <name>", "Environment variable for keystore password")
|
|
71
|
+
.option("--rpc-url <url>", "RPC URL (or set RPC_URL env var)")
|
|
72
|
+
.option("--gas-multiplier <n>", "Gas price multiplier (default: 1.1)")
|
|
73
|
+
.option("--skip-confirm", "Skip confirmation prompt (use with caution)")
|
|
74
|
+
.option("-v, --verbose", "Show verbose output")
|
|
75
|
+
.option("--json", "Output results as JSON")
|
|
76
|
+
.option("--advisor-skills-dir <dir...>", "Directory to load advisor skills (default: ./skills)")
|
|
77
|
+
.option("--state-dir <dir>", "Directory for state database")
|
|
78
|
+
.option("--no-state", "Disable state persistence")
|
|
79
|
+
.action(castCommand);
|
|
80
|
+
// Venues command
|
|
81
|
+
program
|
|
82
|
+
.command("venues")
|
|
83
|
+
.description("List available venue adapters")
|
|
84
|
+
.option("--json", "Output results as JSON")
|
|
85
|
+
.action(venuesCommand);
|
|
86
|
+
// History command
|
|
87
|
+
program
|
|
88
|
+
.command("history [spell]")
|
|
89
|
+
.description("View execution history")
|
|
90
|
+
.option("--limit <n>", "Maximum number of runs to show", "20")
|
|
91
|
+
.option("--json", "Output results as JSON")
|
|
92
|
+
.option("--state-dir <dir>", "Directory for state database")
|
|
93
|
+
.action(historyCommand);
|
|
94
|
+
// Log command
|
|
95
|
+
program
|
|
96
|
+
.command("log <spell> <runId>")
|
|
97
|
+
.description("View ledger events for a run")
|
|
98
|
+
.option("--json", "Output results as JSON")
|
|
99
|
+
.option("--state-dir <dir>", "Directory for state database")
|
|
100
|
+
.action(logCommand);
|
|
101
|
+
// Wallet command
|
|
102
|
+
program.addCommand(walletCommand);
|
|
103
|
+
// Parse and run
|
|
104
|
+
program.parse();
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,E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AC,+BAA+B,EAAE,sDAAsD,CAAC;KAC/F,MAAM,CAAC,mBAAmB,EAAE,8BAA8B,CAAC;KAC3D,MAAM,CAAC,YAAY,EAAE,2BAA2B,CAAC;KACjD,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,iBAAiB;AACjB,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,+BAA+B,CAAC;KAC5C,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC;KAC1C,MAAM,CAAC,aAAa,CAAC,CAAC;AAEzB,kBAAkB;AAClB,OAAO;KACJ,OAAO,CAAC,iBAAiB,CAAC;KAC1B,WAAW,CAAC,wBAAwB,CAAC;KACrC,MAAM,CAAC,aAAa,EAAE,gCAAgC,EAAE,IAAI,CAAC;KAC7D,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC;KAC1C,MAAM,CAAC,mBAAmB,EAAE,8BAA8B,CAAC;KAC3D,MAAM,CAAC,cAAc,CAAC,CAAC;AAE1B,cAAc;AACd,OAAO;KACJ,OAAO,CAAC,qBAAqB,CAAC;KAC9B,WAAW,CAAC,8BAA8B,CAAC;KAC3C,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC;KAC1C,MAAM,CAAC,mBAAmB,EAAE,8BAA8B,CAAC;KAC3D,MAAM,CAAC,UAAU,CAAC,CAAC;AAEtB,iBAAiB;AACjB,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAElC,gBAAgB;AAChB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grimoirelabs/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI for Grimoire spell execution",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"grimoire": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc -p tsconfig.build.json",
|
|
13
|
+
"dev": "bun run src/index.ts",
|
|
14
|
+
"test": "bun test"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@grimoirelabs/core": "0.1.0",
|
|
18
|
+
"@grimoirelabs/venues": "0.1.0",
|
|
19
|
+
"chalk": "^5.3.0",
|
|
20
|
+
"commander": "^12.1.0",
|
|
21
|
+
"ora": "^8.1.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"typescript": "^5.6.3"
|
|
25
|
+
},
|
|
26
|
+
"files": ["dist"]
|
|
27
|
+
}
|