@thyme-sh/cli 0.2.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/README.md +142 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1127 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# @thyme-sh/cli
|
|
2
|
+
|
|
3
|
+
CLI for developing and deploying Thyme Web3 automation tasks.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @thyme-sh/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
### `thyme init [name]`
|
|
14
|
+
|
|
15
|
+
Initialize a new Thyme project.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
thyme init my-project
|
|
19
|
+
cd my-project
|
|
20
|
+
npm install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### `thyme new [name]`
|
|
24
|
+
|
|
25
|
+
Create a new task in the current project.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
thyme new my-task
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Creates:
|
|
32
|
+
- `functions/my-task/index.ts` - Task definition
|
|
33
|
+
- `functions/my-task/args.json` - Test arguments
|
|
34
|
+
|
|
35
|
+
### `thyme run [task]`
|
|
36
|
+
|
|
37
|
+
Run a task locally in a Deno sandbox.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Interactive task picker
|
|
41
|
+
thyme run
|
|
42
|
+
|
|
43
|
+
# Run specific task
|
|
44
|
+
thyme run my-task
|
|
45
|
+
|
|
46
|
+
# Run with on-chain simulation
|
|
47
|
+
thyme run my-task --simulate
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Requires Deno to be installed: https://deno.land/
|
|
51
|
+
|
|
52
|
+
### `thyme list`
|
|
53
|
+
|
|
54
|
+
List all tasks in the current project.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
thyme list
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### `thyme login`
|
|
61
|
+
|
|
62
|
+
Authenticate with Thyme Cloud.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
thyme login
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Opens your browser to generate an API token, then saves it to `.env`.
|
|
69
|
+
|
|
70
|
+
### `thyme upload [task]`
|
|
71
|
+
|
|
72
|
+
Upload a task to Thyme Cloud.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Interactive task and organization picker
|
|
76
|
+
thyme upload
|
|
77
|
+
|
|
78
|
+
# Upload specific task (will prompt for organization)
|
|
79
|
+
thyme upload my-task
|
|
80
|
+
|
|
81
|
+
# Upload to specific organization
|
|
82
|
+
thyme upload my-task --organization org_123abc
|
|
83
|
+
|
|
84
|
+
# Short form
|
|
85
|
+
thyme upload my-task -o org_123abc
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Options:**
|
|
89
|
+
- `-o, --organization <id>` - Organization ID to upload to (skips interactive prompt)
|
|
90
|
+
|
|
91
|
+
**Schema Extraction:**
|
|
92
|
+
When uploading, the CLI automatically extracts the Zod schema from your task definition and converts it to JSON Schema. This allows the frontend dashboard to generate forms for users to input task arguments.
|
|
93
|
+
|
|
94
|
+
The schema is extracted from the `schema` field in your `defineTask()` call:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
export default defineTask({
|
|
98
|
+
schema: z.object({
|
|
99
|
+
targetAddress: z.address(),
|
|
100
|
+
amount: z.number(),
|
|
101
|
+
}),
|
|
102
|
+
async run(ctx) {
|
|
103
|
+
// ...
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The extracted JSON Schema is stored in the database alongside the task code, enabling dynamic form generation in the UI.
|
|
109
|
+
|
|
110
|
+
## Environment Variables
|
|
111
|
+
|
|
112
|
+
Create a `.env` file in your project root:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# RPC URL for blockchain reads and simulation
|
|
116
|
+
RPC_URL=https://eth-sepolia.g.alchemy.com/v2/your-key
|
|
117
|
+
|
|
118
|
+
# Simulation settings (for --simulate flag)
|
|
119
|
+
SIMULATE_ACCOUNT=0x742d35Cc6634C0532925a3b844Bc454e4438f44e
|
|
120
|
+
|
|
121
|
+
# Cloud authentication (set by `thyme login`)
|
|
122
|
+
THYME_AUTH_TOKEN=your-token
|
|
123
|
+
|
|
124
|
+
# Cloud API URL (required - your Convex deployment URL)
|
|
125
|
+
# Example: https://your-deployment.convex.cloud
|
|
126
|
+
THYME_API_URL=https://your-deployment.convex.cloud
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Note:**
|
|
130
|
+
- `RPC_URL` is used for:
|
|
131
|
+
- Providing the public client in task context (`ctx.client`)
|
|
132
|
+
- Running on-chain simulations with `--simulate` flag
|
|
133
|
+
- `THYME_API_URL` should be set to your Convex deployment URL (found in your Convex dashboard or `.env.local` file as `VITE_CONVEX_URL`)
|
|
134
|
+
|
|
135
|
+
## Requirements
|
|
136
|
+
|
|
137
|
+
- Node.js 18+
|
|
138
|
+
- Deno (for local task execution)
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
MIT
|
package/dist/index.d.ts
ADDED