@treza/cli 1.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/LICENSE +21 -0
- package/README.md +353 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +149 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/enclave.d.ts +3 -0
- package/dist/commands/enclave.d.ts.map +1 -0
- package/dist/commands/enclave.js +535 -0
- package/dist/commands/enclave.js.map +1 -0
- package/dist/commands/kyc.d.ts +3 -0
- package/dist/commands/kyc.d.ts.map +1 -0
- package/dist/commands/kyc.js +158 -0
- package/dist/commands/kyc.js.map +1 -0
- package/dist/commands/provider.d.ts +3 -0
- package/dist/commands/provider.d.ts.map +1 -0
- package/dist/commands/provider.js +49 -0
- package/dist/commands/provider.js.map +1 -0
- package/dist/commands/task.d.ts +3 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +220 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/api.d.ts +125 -0
- package/dist/utils/api.d.ts.map +1 -0
- package/dist/utils/api.js +104 -0
- package/dist/utils/api.js.map +1 -0
- package/dist/utils/config.d.ts +13 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +39 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/output.d.ts +12 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +64 -0
- package/dist/utils/output.js.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Treza Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
# Treza CLI
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Command-line interface for the Treza platform</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@treza/cli"><img src="https://img.shields.io/npm/v/@treza/cli.svg" alt="npm version"></a>
|
|
9
|
+
<a href="https://github.com/treza-labs/treza-cli/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
|
10
|
+
<a href="https://trezalabs.com"><img src="https://img.shields.io/badge/docs-trezalabs.com-blue" alt="Documentation"></a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
Manage secure enclaves, verify KYC proofs, and interact with the Treza platform directly from your terminal.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g @treza/cli
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or with yarn:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn global add @treza/cli
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Configure the CLI with your wallet
|
|
33
|
+
treza config init
|
|
34
|
+
|
|
35
|
+
# List your enclaves
|
|
36
|
+
treza enclave list
|
|
37
|
+
|
|
38
|
+
# Create an enclave from a Docker image
|
|
39
|
+
treza enclave create \
|
|
40
|
+
--name "My Enclave" \
|
|
41
|
+
--source-type registry \
|
|
42
|
+
--image nginx:latest \
|
|
43
|
+
--region us-west-2
|
|
44
|
+
|
|
45
|
+
# Create an enclave from a GitHub repository
|
|
46
|
+
treza enclave create \
|
|
47
|
+
--name "My App Enclave" \
|
|
48
|
+
--source-type github \
|
|
49
|
+
--github-repo https://github.com/my-org/my-app \
|
|
50
|
+
--github-branch main \
|
|
51
|
+
--region us-west-2
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Commands
|
|
55
|
+
|
|
56
|
+
### Configuration
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Interactive setup
|
|
60
|
+
treza config init
|
|
61
|
+
|
|
62
|
+
# Show current configuration
|
|
63
|
+
treza config show
|
|
64
|
+
|
|
65
|
+
# Set individual values
|
|
66
|
+
treza config set walletAddress 0x...
|
|
67
|
+
treza config set apiUrl https://app.trezalabs.com
|
|
68
|
+
|
|
69
|
+
# Clear all configuration
|
|
70
|
+
treza config clear
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Enclaves
|
|
74
|
+
|
|
75
|
+
#### List & inspect
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# List all enclaves
|
|
79
|
+
treza enclave list
|
|
80
|
+
treza enc ls # alias
|
|
81
|
+
|
|
82
|
+
# Get enclave details
|
|
83
|
+
treza enclave get <id>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### Create
|
|
87
|
+
|
|
88
|
+
Enclaves support three deployment sources:
|
|
89
|
+
|
|
90
|
+
**From a public Docker / container registry image:**
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
treza enclave create \
|
|
94
|
+
--name "My Enclave" \
|
|
95
|
+
--source-type registry \
|
|
96
|
+
--image nginx:latest \
|
|
97
|
+
--region us-west-2 \
|
|
98
|
+
--instance-type m6i.xlarge \
|
|
99
|
+
--cpu 2 \
|
|
100
|
+
--memory 1024
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**From a GitHub repository** (Treza builds the image automatically):
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
treza enclave create \
|
|
107
|
+
--name "My App Enclave" \
|
|
108
|
+
--source-type github \
|
|
109
|
+
--github-repo https://github.com/my-org/my-app \
|
|
110
|
+
--github-branch main \
|
|
111
|
+
--github-token ghp_xxxxxxxxxxxx \
|
|
112
|
+
--region us-west-2
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
> Your repository must contain a `Dockerfile` at its root. The build status will progress through `PENDING_BUILD → BUILDING → PENDING_DEPLOY → DEPLOYING → DEPLOYED`.
|
|
116
|
+
|
|
117
|
+
**From a private container registry:**
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
treza enclave create \
|
|
121
|
+
--name "My Private Enclave" \
|
|
122
|
+
--source-type private-registry \
|
|
123
|
+
--image registry.example.com/my-org/my-app:latest \
|
|
124
|
+
--registry-url registry.example.com \
|
|
125
|
+
--registry-username myuser \
|
|
126
|
+
--registry-password mypassword \
|
|
127
|
+
--region us-west-2
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Provider & hardware options
|
|
131
|
+
|
|
132
|
+
| Flag | Description | Default |
|
|
133
|
+
|------|-------------|---------|
|
|
134
|
+
| `--provider <id>` | Provider ID | `aws-nitro` |
|
|
135
|
+
| `--instance-type <type>` | EC2 instance type | `m6i.xlarge` |
|
|
136
|
+
| `--cpu <count>` | vCPU count for the enclave | `2` |
|
|
137
|
+
| `--memory <mib>` | Memory in MiB for the enclave | `1024` |
|
|
138
|
+
| `--workload-type <type>` | `service` or `task` | `service` |
|
|
139
|
+
|
|
140
|
+
#### Lifecycle management
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
treza enclave pause <id>
|
|
144
|
+
treza enclave resume <id>
|
|
145
|
+
treza enclave terminate <id>
|
|
146
|
+
treza enclave delete <id>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### Logs
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Application logs (default)
|
|
153
|
+
treza enclave logs <id>
|
|
154
|
+
treza enclave logs <id> --type application --limit 100
|
|
155
|
+
|
|
156
|
+
# Build logs (for GitHub-sourced enclaves)
|
|
157
|
+
treza enclave logs <id> --type build
|
|
158
|
+
|
|
159
|
+
# System logs
|
|
160
|
+
treza enclave logs <id> --type system
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### KYC Verification
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Verify a proof
|
|
167
|
+
treza kyc verify <proof-id>
|
|
168
|
+
|
|
169
|
+
# Get proof details
|
|
170
|
+
treza kyc get <proof-id>
|
|
171
|
+
|
|
172
|
+
# Quick status check
|
|
173
|
+
treza kyc status <proof-id>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Tasks
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# List all tasks
|
|
180
|
+
treza task list
|
|
181
|
+
treza task ls --enclave <enclave-id>
|
|
182
|
+
|
|
183
|
+
# Create a scheduled task
|
|
184
|
+
treza task create
|
|
185
|
+
treza task create --name "Daily Sync" --enclave <id> --schedule "0 0 * * *"
|
|
186
|
+
|
|
187
|
+
# Delete a task
|
|
188
|
+
treza task delete <id>
|
|
189
|
+
|
|
190
|
+
# Show cron examples
|
|
191
|
+
treza task cron
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Providers
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# List available providers
|
|
198
|
+
treza provider list
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Global Options
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
--json # Output as JSON (available on most commands)
|
|
205
|
+
--help, -h # Show help for any command
|
|
206
|
+
--version, -v # Show CLI version
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Configuration
|
|
210
|
+
|
|
211
|
+
The CLI stores configuration in a local config file:
|
|
212
|
+
|
|
213
|
+
| Setting | Description | Default |
|
|
214
|
+
|---------|-------------|---------|
|
|
215
|
+
| `walletAddress` | Your Ethereum wallet address | Required |
|
|
216
|
+
| `apiUrl` | Treza API endpoint | `https://app.trezalabs.com` |
|
|
217
|
+
| `apiKey` | Optional API key for authenticated requests | — |
|
|
218
|
+
|
|
219
|
+
Configuration is stored at:
|
|
220
|
+
- macOS: `~/Library/Preferences/treza-cli-nodejs/config.json`
|
|
221
|
+
- Linux: `~/.config/treza-cli-nodejs/config.json`
|
|
222
|
+
- Windows: `%APPDATA%/treza-cli-nodejs/config.json`
|
|
223
|
+
|
|
224
|
+
## Examples
|
|
225
|
+
|
|
226
|
+
### Deploy from a GitHub repository
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Configure CLI
|
|
230
|
+
treza config init
|
|
231
|
+
|
|
232
|
+
# Create an enclave that builds from your GitHub repo
|
|
233
|
+
treza enclave create \
|
|
234
|
+
--name "Demo App" \
|
|
235
|
+
--source-type github \
|
|
236
|
+
--github-repo https://github.com/my-org/my-app \
|
|
237
|
+
--github-branch main \
|
|
238
|
+
--github-token ghp_xxxxxxxxxxxx \
|
|
239
|
+
--region us-west-2
|
|
240
|
+
|
|
241
|
+
# Monitor build progress
|
|
242
|
+
treza enclave logs <id> --type build
|
|
243
|
+
|
|
244
|
+
# Once status is DEPLOYED, view application logs
|
|
245
|
+
treza enclave logs <id> --type application
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Deploy from Docker Hub
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
treza enclave create \
|
|
252
|
+
--name "Nginx Enclave" \
|
|
253
|
+
--source-type registry \
|
|
254
|
+
--image nginx:latest \
|
|
255
|
+
--region us-west-2
|
|
256
|
+
|
|
257
|
+
# Check status
|
|
258
|
+
treza enclave get <id>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Deploy from a private registry
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
treza enclave create \
|
|
265
|
+
--name "Internal Service" \
|
|
266
|
+
--source-type private-registry \
|
|
267
|
+
--image registry.example.com/my-org/service:v1.0.0 \
|
|
268
|
+
--registry-url registry.example.com \
|
|
269
|
+
--registry-username myuser \
|
|
270
|
+
--registry-password mypassword \
|
|
271
|
+
--region us-west-2
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Verify KYC proofs
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# Quick verification
|
|
278
|
+
treza kyc status 550e8400-e29b-41d4-a716-446655440000
|
|
279
|
+
|
|
280
|
+
# Detailed verification with JSON output
|
|
281
|
+
treza kyc verify 550e8400-e29b-41d4-a716-446655440000 --json
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Scripting and automation
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# List enclaves as JSON for parsing
|
|
288
|
+
treza enclave list --json | jq '.[] | select(.status == "DEPLOYED")'
|
|
289
|
+
|
|
290
|
+
# Create enclave non-interactively
|
|
291
|
+
treza enclave create \
|
|
292
|
+
--name "Automated Enclave" \
|
|
293
|
+
--source-type registry \
|
|
294
|
+
--image my-org/my-service:latest \
|
|
295
|
+
--region us-west-2 \
|
|
296
|
+
--provider aws-nitro
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Enclave Status Lifecycle
|
|
300
|
+
|
|
301
|
+
| Status | Description |
|
|
302
|
+
|--------|-------------|
|
|
303
|
+
| `PENDING_BUILD` | Waiting to start building from GitHub source |
|
|
304
|
+
| `BUILDING` | AWS CodeBuild is building the Docker image |
|
|
305
|
+
| `BUILD_FAILED` | Build failed — check build logs |
|
|
306
|
+
| `PENDING_DEPLOY` | Image ready, waiting to deploy |
|
|
307
|
+
| `DEPLOYING` | EC2 Nitro instance is being provisioned |
|
|
308
|
+
| `DEPLOYED` | Running and healthy |
|
|
309
|
+
| `PAUSED` | Instance stopped |
|
|
310
|
+
| `TERMINATED` | Instance terminated |
|
|
311
|
+
|
|
312
|
+
## Development
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
# Clone the repository
|
|
316
|
+
git clone https://github.com/treza-labs/treza-cli.git
|
|
317
|
+
cd treza-cli
|
|
318
|
+
|
|
319
|
+
# Install dependencies
|
|
320
|
+
npm install
|
|
321
|
+
|
|
322
|
+
# Build
|
|
323
|
+
npm run build
|
|
324
|
+
|
|
325
|
+
# Link for local development
|
|
326
|
+
npm link
|
|
327
|
+
|
|
328
|
+
# Now you can use 'treza' command globally
|
|
329
|
+
treza --help
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Related Projects
|
|
333
|
+
|
|
334
|
+
- **[@treza/sdk](https://github.com/treza-labs/treza-sdk)** - TypeScript SDK for programmatic access
|
|
335
|
+
- **[treza-app](https://github.com/treza-labs/treza-app)** - Web dashboard and API
|
|
336
|
+
- **[treza-mobile](https://github.com/treza-labs/treza-mobile)** - iOS app for ZK proof generation
|
|
337
|
+
- **[treza-contracts](https://github.com/treza-labs/treza-contracts)** - Smart contracts for KYC verification
|
|
338
|
+
|
|
339
|
+
## Support
|
|
340
|
+
|
|
341
|
+
- **Documentation**: [docs.trezalabs.com](https://docs.trezalabs.com)
|
|
342
|
+
- **Issues**: [GitHub Issues](https://github.com/treza-labs/treza-cli/issues)
|
|
343
|
+
- **Website**: [trezalabs.com](https://trezalabs.com)
|
|
344
|
+
|
|
345
|
+
## License
|
|
346
|
+
|
|
347
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
<p align="center">
|
|
352
|
+
Built by <a href="https://trezalabs.com">Treza Labs</a> — Privacy infrastructure for the next era of finance.
|
|
353
|
+
</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,aAAa,SACgB,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import prompts from 'prompts';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { getConfig, isConfigured } from '../utils/config.js';
|
|
5
|
+
import * as output from '../utils/output.js';
|
|
6
|
+
export const configCommand = new Command('config')
|
|
7
|
+
.description('Manage CLI configuration');
|
|
8
|
+
configCommand
|
|
9
|
+
.command('init')
|
|
10
|
+
.description('Initialize CLI configuration')
|
|
11
|
+
.action(async () => {
|
|
12
|
+
console.log(chalk.bold('\n🔧 Treza CLI Configuration\n'));
|
|
13
|
+
const config = getConfig();
|
|
14
|
+
const currentWallet = config.get('walletAddress');
|
|
15
|
+
const currentUrl = config.get('apiUrl');
|
|
16
|
+
const response = await prompts([
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
name: 'walletAddress',
|
|
20
|
+
message: 'Your wallet address (Ethereum/Solana)',
|
|
21
|
+
initial: currentWallet,
|
|
22
|
+
validate: (value) => {
|
|
23
|
+
if (!value)
|
|
24
|
+
return 'Wallet address is required';
|
|
25
|
+
if (!value.startsWith('0x') && value.length < 32) {
|
|
26
|
+
return 'Invalid wallet address format';
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'select',
|
|
33
|
+
name: 'apiUrl',
|
|
34
|
+
message: 'API Environment',
|
|
35
|
+
choices: [
|
|
36
|
+
{ title: 'Production (app.trezalabs.com)', value: 'https://app.trezalabs.com' },
|
|
37
|
+
{ title: 'Local Development (localhost:3000)', value: 'http://localhost:3000' },
|
|
38
|
+
{ title: 'Custom', value: 'custom' },
|
|
39
|
+
],
|
|
40
|
+
initial: currentUrl === 'http://localhost:3000' ? 1 : 0,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: (prev) => prev === 'custom' ? 'text' : null,
|
|
44
|
+
name: 'customApiUrl',
|
|
45
|
+
message: 'Custom API URL',
|
|
46
|
+
validate: (value) => {
|
|
47
|
+
try {
|
|
48
|
+
new URL(value);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return 'Invalid URL';
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
name: 'apiKey',
|
|
59
|
+
message: 'API Key (optional, press Enter to skip)',
|
|
60
|
+
initial: config.get('apiKey') || '',
|
|
61
|
+
},
|
|
62
|
+
]);
|
|
63
|
+
if (!response.walletAddress) {
|
|
64
|
+
output.error('Configuration cancelled');
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const apiUrl = response.customApiUrl || response.apiUrl;
|
|
68
|
+
config.set('walletAddress', response.walletAddress);
|
|
69
|
+
config.set('apiUrl', apiUrl);
|
|
70
|
+
if (response.apiKey) {
|
|
71
|
+
config.set('apiKey', response.apiKey);
|
|
72
|
+
}
|
|
73
|
+
console.log('');
|
|
74
|
+
output.success('Configuration saved!');
|
|
75
|
+
console.log('');
|
|
76
|
+
output.keyValue('Wallet', response.walletAddress);
|
|
77
|
+
output.keyValue('API URL', apiUrl);
|
|
78
|
+
if (response.apiKey) {
|
|
79
|
+
output.keyValue('API Key', '••••••••' + response.apiKey.slice(-4));
|
|
80
|
+
}
|
|
81
|
+
console.log('');
|
|
82
|
+
console.log(chalk.gray(`Config stored at: ${config.path}`));
|
|
83
|
+
});
|
|
84
|
+
configCommand
|
|
85
|
+
.command('show')
|
|
86
|
+
.description('Show current configuration')
|
|
87
|
+
.option('--json', 'Output as JSON')
|
|
88
|
+
.action((options) => {
|
|
89
|
+
const config = getConfig();
|
|
90
|
+
if (options.json) {
|
|
91
|
+
output.json({
|
|
92
|
+
walletAddress: config.get('walletAddress'),
|
|
93
|
+
apiUrl: config.get('apiUrl'),
|
|
94
|
+
hasApiKey: !!config.get('apiKey'),
|
|
95
|
+
configPath: config.path,
|
|
96
|
+
});
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (!isConfigured()) {
|
|
100
|
+
output.warn('Not configured. Run: treza config init');
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
output.heading('Current Configuration');
|
|
104
|
+
output.keyValue('Wallet Address', config.get('walletAddress') || '(not set)');
|
|
105
|
+
output.keyValue('API URL', config.get('apiUrl') || 'https://app.trezalabs.com');
|
|
106
|
+
output.keyValue('API Key', config.get('apiKey') ? '••••••••' + config.get('apiKey').slice(-4) : '(not set)');
|
|
107
|
+
console.log('');
|
|
108
|
+
console.log(chalk.gray(`Config file: ${config.path}`));
|
|
109
|
+
});
|
|
110
|
+
configCommand
|
|
111
|
+
.command('set <key> <value>')
|
|
112
|
+
.description('Set a configuration value')
|
|
113
|
+
.action((key, value) => {
|
|
114
|
+
const config = getConfig();
|
|
115
|
+
const validKeys = ['walletAddress', 'apiUrl', 'apiKey'];
|
|
116
|
+
if (!validKeys.includes(key)) {
|
|
117
|
+
output.error(`Invalid key: ${key}. Valid keys: ${validKeys.join(', ')}`);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
config.set(key, value);
|
|
121
|
+
output.success(`Set ${key} = ${key === 'apiKey' ? '••••••••' : value}`);
|
|
122
|
+
});
|
|
123
|
+
configCommand
|
|
124
|
+
.command('clear')
|
|
125
|
+
.description('Clear all configuration')
|
|
126
|
+
.action(async () => {
|
|
127
|
+
const response = await prompts({
|
|
128
|
+
type: 'confirm',
|
|
129
|
+
name: 'confirm',
|
|
130
|
+
message: 'Are you sure you want to clear all configuration?',
|
|
131
|
+
initial: false,
|
|
132
|
+
});
|
|
133
|
+
if (response.confirm) {
|
|
134
|
+
const config = getConfig();
|
|
135
|
+
config.clear();
|
|
136
|
+
output.success('Configuration cleared');
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
output.info('Cancelled');
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
configCommand
|
|
143
|
+
.command('path')
|
|
144
|
+
.description('Show configuration file path')
|
|
145
|
+
.action(() => {
|
|
146
|
+
const config = getConfig();
|
|
147
|
+
console.log(config.path);
|
|
148
|
+
});
|
|
149
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAE7C,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,0BAA0B,CAAC,CAAC;AAE3C,aAAa;KACV,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,8BAA8B,CAAC;KAC3C,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,gCAAgC,CA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