clawup 1.0.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 +245 -0
- package/dist/adapters/api-adapter.d.ts +76 -0
- package/dist/adapters/api-adapter.js +250 -0
- package/dist/adapters/api-adapter.js.map +1 -0
- package/dist/adapters/cli-adapter.d.ts +15 -0
- package/dist/adapters/cli-adapter.js +208 -0
- package/dist/adapters/cli-adapter.js.map +1 -0
- package/dist/adapters/index.d.ts +22 -0
- package/dist/adapters/index.js +32 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/types.d.ts +135 -0
- package/dist/adapters/types.js +14 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/bin.d.ts +8 -0
- package/dist/bin.js +221 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/config.d.ts +21 -0
- package/dist/commands/config.js +323 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/deploy.d.ts +7 -0
- package/dist/commands/deploy.js +13 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/destroy.d.ts +7 -0
- package/dist/commands/destroy.js +13 -0
- package/dist/commands/destroy.js.map +1 -0
- package/dist/commands/init.d.ts +13 -0
- package/dist/commands/init.js +698 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +8 -0
- package/dist/commands/list.js +42 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/push.d.ts +7 -0
- package/dist/commands/push.js +19 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/redeploy.d.ts +7 -0
- package/dist/commands/redeploy.js +13 -0
- package/dist/commands/redeploy.js.map +1 -0
- package/dist/commands/secrets.d.ts +16 -0
- package/dist/commands/secrets.js +169 -0
- package/dist/commands/secrets.js.map +1 -0
- package/dist/commands/ssh.d.ts +9 -0
- package/dist/commands/ssh.js +108 -0
- package/dist/commands/ssh.js.map +1 -0
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.js +13 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/update.d.ts +7 -0
- package/dist/commands/update.js +126 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +7 -0
- package/dist/commands/validate.js +13 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/webhooks.d.ts +7 -0
- package/dist/commands/webhooks.js +13 -0
- package/dist/commands/webhooks.js.map +1 -0
- package/dist/lib/__tests__/identity.test.d.ts +1 -0
- package/dist/lib/__tests__/identity.test.js +186 -0
- package/dist/lib/__tests__/identity.test.js.map +1 -0
- package/dist/lib/__tests__/validate-agent.test.d.ts +1 -0
- package/dist/lib/__tests__/validate-agent.test.js +38 -0
- package/dist/lib/__tests__/validate-agent.test.js.map +1 -0
- package/dist/lib/config.d.ts +69 -0
- package/dist/lib/config.js +218 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/constants.d.ts +5 -0
- package/dist/lib/constants.js +29 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/exec.d.ts +24 -0
- package/dist/lib/exec.js +63 -0
- package/dist/lib/exec.js.map +1 -0
- package/dist/lib/prerequisites.d.ts +8 -0
- package/dist/lib/prerequisites.js +146 -0
- package/dist/lib/prerequisites.js.map +1 -0
- package/dist/lib/process.d.ts +18 -0
- package/dist/lib/process.js +37 -0
- package/dist/lib/process.js.map +1 -0
- package/dist/lib/pulumi.d.ts +37 -0
- package/dist/lib/pulumi.js +87 -0
- package/dist/lib/pulumi.js.map +1 -0
- package/dist/lib/tailscale.d.ts +75 -0
- package/dist/lib/tailscale.js +251 -0
- package/dist/lib/tailscale.js.map +1 -0
- package/dist/lib/tool-helpers.d.ts +15 -0
- package/dist/lib/tool-helpers.js +35 -0
- package/dist/lib/tool-helpers.js.map +1 -0
- package/dist/lib/ui.d.ts +26 -0
- package/dist/lib/ui.js +86 -0
- package/dist/lib/ui.js.map +1 -0
- package/dist/lib/update-check.d.ts +8 -0
- package/dist/lib/update-check.js +151 -0
- package/dist/lib/update-check.js.map +1 -0
- package/dist/lib/vendor.d.ts +34 -0
- package/dist/lib/vendor.js +128 -0
- package/dist/lib/vendor.js.map +1 -0
- package/dist/lib/workspace.d.ts +21 -0
- package/dist/lib/workspace.js +170 -0
- package/dist/lib/workspace.js.map +1 -0
- package/dist/tools/deploy.d.ts +16 -0
- package/dist/tools/deploy.js +181 -0
- package/dist/tools/deploy.js.map +1 -0
- package/dist/tools/destroy.d.ts +16 -0
- package/dist/tools/destroy.js +119 -0
- package/dist/tools/destroy.js.map +1 -0
- package/dist/tools/index.d.ts +20 -0
- package/dist/tools/index.js +34 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/push.d.ts +29 -0
- package/dist/tools/push.js +341 -0
- package/dist/tools/push.js.map +1 -0
- package/dist/tools/redeploy.d.ts +17 -0
- package/dist/tools/redeploy.js +181 -0
- package/dist/tools/redeploy.js.map +1 -0
- package/dist/tools/status.d.ts +16 -0
- package/dist/tools/status.js +205 -0
- package/dist/tools/status.js.map +1 -0
- package/dist/tools/validate.d.ts +16 -0
- package/dist/tools/validate.js +219 -0
- package/dist/tools/validate.js.map +1 -0
- package/dist/tools/webhooks.d.ts +17 -0
- package/dist/tools/webhooks.js +181 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/infra/Pulumi.yaml +6 -0
- package/infra/dist/components/cloud-init.js +412 -0
- package/infra/dist/components/config-generator.js +254 -0
- package/infra/dist/components/hetzner-agent.js +162 -0
- package/infra/dist/components/index.js +18 -0
- package/infra/dist/components/openclaw-agent.js +287 -0
- package/infra/dist/components/shared.js +132 -0
- package/infra/dist/components/types.js +6 -0
- package/infra/dist/index.js +387 -0
- package/infra/dist/shared-vpc.js +167 -0
- package/infra/node_modules/@clawup/core/dist/__tests__/schemas.test.d.ts +2 -0
- package/infra/node_modules/@clawup/core/dist/__tests__/schemas.test.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/__tests__/schemas.test.js +124 -0
- package/infra/node_modules/@clawup/core/dist/__tests__/schemas.test.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/coding-agent-registry.d.ts +32 -0
- package/infra/node_modules/@clawup/core/dist/coding-agent-registry.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/coding-agent-registry.js +56 -0
- package/infra/node_modules/@clawup/core/dist/coding-agent-registry.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/constants.d.ts +137 -0
- package/infra/node_modules/@clawup/core/dist/constants.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/constants.js +314 -0
- package/infra/node_modules/@clawup/core/dist/constants.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/dep-registry.d.ts +25 -0
- package/infra/node_modules/@clawup/core/dist/dep-registry.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/dep-registry.js +46 -0
- package/infra/node_modules/@clawup/core/dist/dep-registry.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/deps.d.ts +18 -0
- package/infra/node_modules/@clawup/core/dist/deps.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/deps.js +39 -0
- package/infra/node_modules/@clawup/core/dist/deps.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/identity.d.ts +20 -0
- package/infra/node_modules/@clawup/core/dist/identity.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/identity.js +217 -0
- package/infra/node_modules/@clawup/core/dist/identity.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/index.d.ts +18 -0
- package/infra/node_modules/@clawup/core/dist/index.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/index.js +52 -0
- package/infra/node_modules/@clawup/core/dist/index.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/plugin-registry.d.ts +13 -0
- package/infra/node_modules/@clawup/core/dist/plugin-registry.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/plugin-registry.js +24 -0
- package/infra/node_modules/@clawup/core/dist/plugin-registry.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/schemas/identity.d.ts +74 -0
- package/infra/node_modules/@clawup/core/dist/schemas/identity.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/schemas/identity.js +45 -0
- package/infra/node_modules/@clawup/core/dist/schemas/identity.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/schemas/index.d.ts +6 -0
- package/infra/node_modules/@clawup/core/dist/schemas/index.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/schemas/index.js +13 -0
- package/infra/node_modules/@clawup/core/dist/schemas/index.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/schemas/manifest.d.ts +159 -0
- package/infra/node_modules/@clawup/core/dist/schemas/manifest.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/schemas/manifest.js +54 -0
- package/infra/node_modules/@clawup/core/dist/schemas/manifest.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/skills.d.ts +30 -0
- package/infra/node_modules/@clawup/core/dist/skills.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/skills.js +52 -0
- package/infra/node_modules/@clawup/core/dist/skills.js.map +1 -0
- package/infra/node_modules/@clawup/core/dist/types.d.ts +59 -0
- package/infra/node_modules/@clawup/core/dist/types.d.ts.map +1 -0
- package/infra/node_modules/@clawup/core/dist/types.js +30 -0
- package/infra/node_modules/@clawup/core/dist/types.js.map +1 -0
- package/infra/node_modules/@clawup/core/package.json +46 -0
- package/infra/package.json +12 -0
- package/package.json +43 -0
- package/scripts/postinstall.mjs +395 -0
package/README.md
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# Clawup CLI
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/clawup)
|
|
4
|
+
|
|
5
|
+
Interactive command-line tool for deploying and managing your fleet of [OpenClaw](https://openclaw.bot/) AI agents on **AWS** or **Hetzner Cloud**.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Global install
|
|
11
|
+
npm install -g clawup
|
|
12
|
+
|
|
13
|
+
# Or run directly
|
|
14
|
+
npx clawup init
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
### `clawup init`
|
|
20
|
+
|
|
21
|
+
Interactive setup wizard that walks you through the full configuration:
|
|
22
|
+
|
|
23
|
+
1. **Prerequisites check** — verifies Pulumi CLI, Node.js, cloud provider CLI, and Tailscale are installed
|
|
24
|
+
2. **Cloud provider** — AWS or Hetzner Cloud
|
|
25
|
+
3. **Region & instance type** — with cost estimates shown inline
|
|
26
|
+
4. **Secrets** — Anthropic API key, Tailscale auth key (with inline instructions for each)
|
|
27
|
+
5. **Agent selection** — choose from presets, define custom agents, or mix both
|
|
28
|
+
6. **Optional integrations** — Slack, Linear, GitHub per agent
|
|
29
|
+
7. **Summary & confirmation** — review config and estimated cost before proceeding
|
|
30
|
+
|
|
31
|
+
Outputs a `clawup.yaml` manifest and sets all Pulumi config values.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
clawup init # Interactive wizard
|
|
35
|
+
clawup init --deploy # Deploy immediately after setup
|
|
36
|
+
clawup init --deploy -y # Deploy without confirmation
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### `clawup deploy`
|
|
40
|
+
|
|
41
|
+
Deploy your agents with `pulumi up`. Runs prerequisite checks before deploying.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
clawup deploy # Deploy with confirmation prompt
|
|
45
|
+
clawup deploy -y # Skip confirmation
|
|
46
|
+
clawup deploy -c staging # Deploy a specific config
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### `clawup status`
|
|
50
|
+
|
|
51
|
+
Show agent statuses from Pulumi stack outputs.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
clawup status # Pretty-printed output
|
|
55
|
+
clawup status --json # JSON output
|
|
56
|
+
clawup status -c staging # Status for a specific config
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `clawup ssh <agent>`
|
|
60
|
+
|
|
61
|
+
SSH to an agent by name, role, or alias. Resolves agents flexibly — all of these work:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
clawup ssh juno # By alias
|
|
65
|
+
clawup ssh pm # By role
|
|
66
|
+
clawup ssh agent-pm # By resource name
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Run a command on the agent instead of opening an interactive session:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
clawup ssh juno 'openclaw gateway status'
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Options:
|
|
76
|
+
|
|
77
|
+
| Flag | Description |
|
|
78
|
+
|------|-------------|
|
|
79
|
+
| `-u, --user <user>` | SSH user (default: `ubuntu`) |
|
|
80
|
+
| `-c, --config <name>` | Config name (auto-detected if only one) |
|
|
81
|
+
|
|
82
|
+
### `clawup validate`
|
|
83
|
+
|
|
84
|
+
Health check all agents via Tailscale SSH.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
clawup validate # Default 30-second timeout
|
|
88
|
+
clawup validate -t 60 # 60-second timeout
|
|
89
|
+
clawup validate -c staging # Validate a specific config
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `clawup destroy`
|
|
93
|
+
|
|
94
|
+
Tear down all resources with safety confirmations.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
clawup destroy # With confirmation prompts
|
|
98
|
+
clawup destroy -y # Skip confirmations (dangerous!)
|
|
99
|
+
clawup destroy -c staging # Destroy a specific config
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### `clawup redeploy`
|
|
103
|
+
|
|
104
|
+
Update agents in-place without destroying infrastructure. Runs `pulumi up --refresh` to sync cloud state and apply changes. If the stack doesn't exist, falls back to a fresh deploy.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
clawup redeploy # With confirmation prompt
|
|
108
|
+
clawup redeploy -y # Skip confirmation
|
|
109
|
+
clawup redeploy -c staging # Redeploy a specific config
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### `clawup config show`
|
|
113
|
+
|
|
114
|
+
Display current configuration in a human-readable format.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
clawup config show # Pretty-printed output
|
|
118
|
+
clawup config show --json # Full JSON output
|
|
119
|
+
clawup config show -c staging # Show a specific config
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### `clawup config set <key> <value>`
|
|
123
|
+
|
|
124
|
+
Update a config value with validation. No need to re-run `init`.
|
|
125
|
+
|
|
126
|
+
Top-level keys: `region`, `instanceType`, `ownerName`, `timezone`, `workingHours`, `userNotes`, `linearTeam`, `githubRepo`
|
|
127
|
+
|
|
128
|
+
Per-agent keys: `instanceType`, `volumeSize`, `displayName`
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
clawup config set region us-west-2
|
|
132
|
+
clawup config set instanceType t3.large
|
|
133
|
+
clawup config set instanceType cx32 -a titus # Per-agent override
|
|
134
|
+
clawup config set volumeSize 50 -a scout # Per-agent volume
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### `clawup secrets set <key> <value>`
|
|
138
|
+
|
|
139
|
+
Set a Pulumi secret without re-running `init`. Useful for adding or rotating API keys post-setup.
|
|
140
|
+
|
|
141
|
+
Global keys: `anthropicApiKey`, `tailscaleAuthKey`, `tailscaleApiKey`, `tailnetDnsName`, `braveApiKey`
|
|
142
|
+
|
|
143
|
+
Per-agent keys (use `--agent`): `slackBotToken`, `slackAppToken`, `linearApiKey`, `linearWebhookSecret`, `linearUserUuid`, `githubToken`
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
clawup secrets set braveApiKey BSA_xxx
|
|
147
|
+
clawup secrets set braveApiKey BSA_xxx -c team-h3
|
|
148
|
+
clawup secrets set slackBotToken xoxb-xxx --agent eng
|
|
149
|
+
clawup secrets set githubToken ghp_xxx --agent pm -c staging
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### `clawup secrets list`
|
|
153
|
+
|
|
154
|
+
Show which secrets are configured (values redacted).
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
clawup secrets list # Auto-detect config
|
|
158
|
+
clawup secrets list -c team-h3 # Specific config
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### `clawup list`
|
|
162
|
+
|
|
163
|
+
List all saved configurations.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
clawup list # Pretty-printed output
|
|
167
|
+
clawup list --json # JSON output
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Preset Agents
|
|
171
|
+
|
|
172
|
+
The CLI ships with three preset agent configurations:
|
|
173
|
+
|
|
174
|
+
| Alias | Role | Name | Description |
|
|
175
|
+
|-------|------|------|-------------|
|
|
176
|
+
| **Juno** | PM | `agent-pm` | Break down tickets, research, plan and sequence work, track progress, unblock teams |
|
|
177
|
+
| **Titus** | Engineer | `agent-eng` | Lead engineering, coding, shipping |
|
|
178
|
+
| **Scout** | Tester | `agent-tester` | Quality assurance, verification, bug hunting |
|
|
179
|
+
|
|
180
|
+
You can also define fully custom agents during `init`.
|
|
181
|
+
|
|
182
|
+
## Configuration
|
|
183
|
+
|
|
184
|
+
### `clawup.yaml`
|
|
185
|
+
|
|
186
|
+
The `init` command generates a `clawup.yaml` manifest:
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
stackName: dev
|
|
190
|
+
provider: aws
|
|
191
|
+
region: us-east-1
|
|
192
|
+
instanceType: t3.medium
|
|
193
|
+
ownerName: Your Name
|
|
194
|
+
agents:
|
|
195
|
+
- name: agent-pm
|
|
196
|
+
displayName: Juno
|
|
197
|
+
role: pm
|
|
198
|
+
identity: "https://github.com/your-org/army-identities#pm"
|
|
199
|
+
volumeSize: 30
|
|
200
|
+
plugins:
|
|
201
|
+
openclaw-linear:
|
|
202
|
+
agentId: agent-pm
|
|
203
|
+
slack:
|
|
204
|
+
mode: socket
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
This manifest is read by the Pulumi program at deploy time to dynamically create the agent stack.
|
|
208
|
+
|
|
209
|
+
### Pulumi Config
|
|
210
|
+
|
|
211
|
+
Secrets and stack configuration are stored in Pulumi config (encrypted). The `init` command sets these automatically:
|
|
212
|
+
|
|
213
|
+
- `anthropicApiKey` (secret)
|
|
214
|
+
- `tailscaleAuthKey` (secret)
|
|
215
|
+
- `tailnetDnsName`
|
|
216
|
+
- `aws:region` (AWS) or `hcloud:token` (Hetzner)
|
|
217
|
+
- `instanceType`
|
|
218
|
+
- `ownerName`
|
|
219
|
+
|
|
220
|
+
## Project Structure
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
packages/cli/
|
|
224
|
+
├── bin.ts # Entry point (Commander.js program)
|
|
225
|
+
├── commands/ # Command handlers (init, deploy, ssh, secrets, push, webhooks, etc.)
|
|
226
|
+
├── tools/ # Tool implementations (adapter-based: deploy, destroy, redeploy, status, validate, push, webhooks)
|
|
227
|
+
├── lib/ # CLI-only utilities
|
|
228
|
+
│ ├── config.ts # Load/save clawup.yaml manifest
|
|
229
|
+
│ ├── exec.ts # Shell command execution
|
|
230
|
+
│ ├── prerequisites.ts # Prerequisite checks
|
|
231
|
+
│ ├── process.ts # Graceful shutdown handling
|
|
232
|
+
│ ├── pulumi.ts # Pulumi stack & config operations
|
|
233
|
+
│ ├── tailscale.ts # Tailscale device management
|
|
234
|
+
│ ├── tool-helpers.ts # Shared helpers for tool implementations
|
|
235
|
+
│ └── ui.ts # UI helpers (banners, spinners, formatting)
|
|
236
|
+
└── adapters/ # Runtime adapters (CLI vs API)
|
|
237
|
+
|
|
238
|
+
# Shared types, constants, and registries live in @clawup/core (packages/core/)
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Dependencies
|
|
242
|
+
|
|
243
|
+
- [Commander.js](https://github.com/tj/commander.js) — CLI argument parsing
|
|
244
|
+
- [@clack/prompts](https://github.com/natemoo-re/clack) — Interactive terminal prompts
|
|
245
|
+
- [picocolors](https://github.com/alexeyraspopov/picocolors) — Terminal colors
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Runtime Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements RuntimeAdapter for HTTP API usage.
|
|
5
|
+
* Instead of interactive prompts, collects inputs from a request body
|
|
6
|
+
* and accumulates responses as structured JSON.
|
|
7
|
+
*/
|
|
8
|
+
import type { RuntimeAdapter } from "./types";
|
|
9
|
+
/** A field descriptor returned instead of prompting */
|
|
10
|
+
export interface FieldDescriptor {
|
|
11
|
+
type: "text" | "confirm" | "select" | "multiSelect";
|
|
12
|
+
name: string;
|
|
13
|
+
message: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
defaultValue?: unknown;
|
|
16
|
+
options?: Array<{
|
|
17
|
+
value: unknown;
|
|
18
|
+
label: string;
|
|
19
|
+
hint?: string;
|
|
20
|
+
}>;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** A log entry accumulated during execution */
|
|
24
|
+
export interface LogEntry {
|
|
25
|
+
level: "info" | "step" | "success" | "warn" | "error";
|
|
26
|
+
message: string;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
}
|
|
29
|
+
/** Accumulated API response */
|
|
30
|
+
export interface APIResponse {
|
|
31
|
+
/** Fields that need user input (wizard mode) */
|
|
32
|
+
fields: FieldDescriptor[];
|
|
33
|
+
/** Log messages accumulated during execution */
|
|
34
|
+
logs: LogEntry[];
|
|
35
|
+
/** Notes/messages shown to the user */
|
|
36
|
+
messages: Array<{
|
|
37
|
+
type: "intro" | "note" | "outro" | "cancel";
|
|
38
|
+
content: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
}>;
|
|
41
|
+
/** Whether the operation completed or needs more input */
|
|
42
|
+
status: "needsInput" | "complete" | "cancelled" | "error";
|
|
43
|
+
}
|
|
44
|
+
/** Thrown when the adapter needs more input from the client */
|
|
45
|
+
export declare class APIAdapterNeedsInputError extends Error {
|
|
46
|
+
fieldName: string;
|
|
47
|
+
constructor(fieldName: string);
|
|
48
|
+
}
|
|
49
|
+
/** Thrown when validation fails on a provided input */
|
|
50
|
+
export declare class APIAdapterValidationError extends Error {
|
|
51
|
+
fieldName: string;
|
|
52
|
+
validationMessage: string;
|
|
53
|
+
constructor(fieldName: string, validationMessage: string);
|
|
54
|
+
}
|
|
55
|
+
/** Thrown when the operation is cancelled */
|
|
56
|
+
export declare class APIAdapterCancelError extends Error {
|
|
57
|
+
constructor(message: string);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Create an API runtime adapter for HTTP request handling.
|
|
61
|
+
*
|
|
62
|
+
* @param inputs - Key-value pairs from the request body providing answers to wizard fields
|
|
63
|
+
* @returns A tuple of [RuntimeAdapter, APIResponse] — use the response to send back to the client
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* const [adapter, response] = createAPIAdapter({ field_0: "my-project", field_1: "aws" });
|
|
67
|
+
* try {
|
|
68
|
+
* await initTool(adapter, {});
|
|
69
|
+
* } catch (e) {
|
|
70
|
+
* if (e instanceof APIAdapterNeedsInputError) {
|
|
71
|
+
* // Return response.fields to client for more input
|
|
72
|
+
* }
|
|
73
|
+
* }
|
|
74
|
+
* res.json(response);
|
|
75
|
+
*/
|
|
76
|
+
export declare function createAPIAdapter(inputs?: Record<string, unknown>): [RuntimeAdapter, APIResponse];
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API Runtime Adapter
|
|
4
|
+
*
|
|
5
|
+
* Implements RuntimeAdapter for HTTP API usage.
|
|
6
|
+
* Instead of interactive prompts, collects inputs from a request body
|
|
7
|
+
* and accumulates responses as structured JSON.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.APIAdapterCancelError = exports.APIAdapterValidationError = exports.APIAdapterNeedsInputError = void 0;
|
|
11
|
+
exports.createAPIAdapter = createAPIAdapter;
|
|
12
|
+
const vendor_1 = require("../lib/vendor");
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Execution Adapter Implementation
|
|
15
|
+
// ============================================================================
|
|
16
|
+
class APIExecAdapter {
|
|
17
|
+
capture(command, args = [], cwd) {
|
|
18
|
+
const { execFileSync } = require("child_process");
|
|
19
|
+
const resolved = (0, vendor_1.resolveCommand)(command);
|
|
20
|
+
try {
|
|
21
|
+
const result = execFileSync(resolved, args, {
|
|
22
|
+
cwd,
|
|
23
|
+
encoding: "utf-8",
|
|
24
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
25
|
+
});
|
|
26
|
+
return { stdout: result.trim(), stderr: "", exitCode: 0 };
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
const e = err;
|
|
30
|
+
return {
|
|
31
|
+
stdout: (e.stdout ?? "").toString().trim(),
|
|
32
|
+
stderr: (e.stderr ?? "").toString().trim(),
|
|
33
|
+
exitCode: e.status ?? 1,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async stream(command, args = [], options) {
|
|
38
|
+
// In API context, always capture output
|
|
39
|
+
const result = this.capture(command, args, options?.cwd);
|
|
40
|
+
return result.exitCode;
|
|
41
|
+
}
|
|
42
|
+
commandExists(command) {
|
|
43
|
+
return (0, vendor_1.commandExistsWithVendor)(command);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// UI Adapter Implementation
|
|
48
|
+
// ============================================================================
|
|
49
|
+
class APIUIAdapter {
|
|
50
|
+
response;
|
|
51
|
+
inputs;
|
|
52
|
+
fieldIndex = 0;
|
|
53
|
+
constructor(inputs, response) {
|
|
54
|
+
this.inputs = inputs;
|
|
55
|
+
this.response = response;
|
|
56
|
+
}
|
|
57
|
+
intro(message) {
|
|
58
|
+
this.response.messages.push({ type: "intro", content: message });
|
|
59
|
+
}
|
|
60
|
+
note(content, title) {
|
|
61
|
+
this.response.messages.push({ type: "note", content, title });
|
|
62
|
+
}
|
|
63
|
+
outro(message) {
|
|
64
|
+
this.response.messages.push({ type: "outro", content: message });
|
|
65
|
+
this.response.status = "complete";
|
|
66
|
+
}
|
|
67
|
+
cancel(message) {
|
|
68
|
+
this.response.messages.push({ type: "cancel", content: message });
|
|
69
|
+
this.response.status = "cancelled";
|
|
70
|
+
throw new APIAdapterCancelError(message);
|
|
71
|
+
}
|
|
72
|
+
log = {
|
|
73
|
+
info: (message) => {
|
|
74
|
+
this.response.logs.push({ level: "info", message, timestamp: Date.now() });
|
|
75
|
+
},
|
|
76
|
+
step: (message) => {
|
|
77
|
+
this.response.logs.push({ level: "step", message, timestamp: Date.now() });
|
|
78
|
+
},
|
|
79
|
+
success: (message) => {
|
|
80
|
+
this.response.logs.push({ level: "success", message, timestamp: Date.now() });
|
|
81
|
+
},
|
|
82
|
+
warn: (message) => {
|
|
83
|
+
this.response.logs.push({ level: "warn", message, timestamp: Date.now() });
|
|
84
|
+
},
|
|
85
|
+
error: (message) => {
|
|
86
|
+
this.response.logs.push({ level: "error", message, timestamp: Date.now() });
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
async text(options) {
|
|
90
|
+
const fieldName = `field_${this.fieldIndex++}`;
|
|
91
|
+
// Check if input was provided
|
|
92
|
+
if (fieldName in this.inputs || options.message in this.inputs) {
|
|
93
|
+
const key = fieldName in this.inputs ? fieldName : options.message;
|
|
94
|
+
const value = String(this.inputs[key]);
|
|
95
|
+
if (options.validate) {
|
|
96
|
+
const error = options.validate(value);
|
|
97
|
+
if (error) {
|
|
98
|
+
throw new APIAdapterValidationError(fieldName, error);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
// No input provided — add field descriptor for client
|
|
104
|
+
this.response.fields.push({
|
|
105
|
+
type: "text",
|
|
106
|
+
name: fieldName,
|
|
107
|
+
message: options.message,
|
|
108
|
+
placeholder: options.placeholder,
|
|
109
|
+
defaultValue: options.defaultValue,
|
|
110
|
+
});
|
|
111
|
+
this.response.status = "needsInput";
|
|
112
|
+
throw new APIAdapterNeedsInputError(fieldName);
|
|
113
|
+
}
|
|
114
|
+
async confirm(options) {
|
|
115
|
+
const fieldName = `field_${this.fieldIndex++}`;
|
|
116
|
+
if (fieldName in this.inputs || options.message in this.inputs) {
|
|
117
|
+
const key = fieldName in this.inputs ? fieldName : options.message;
|
|
118
|
+
return Boolean(this.inputs[key]);
|
|
119
|
+
}
|
|
120
|
+
this.response.fields.push({
|
|
121
|
+
type: "confirm",
|
|
122
|
+
name: fieldName,
|
|
123
|
+
message: options.message,
|
|
124
|
+
defaultValue: options.initialValue,
|
|
125
|
+
});
|
|
126
|
+
this.response.status = "needsInput";
|
|
127
|
+
throw new APIAdapterNeedsInputError(fieldName);
|
|
128
|
+
}
|
|
129
|
+
async select(options) {
|
|
130
|
+
const fieldName = `field_${this.fieldIndex++}`;
|
|
131
|
+
if (fieldName in this.inputs || options.message in this.inputs) {
|
|
132
|
+
const key = fieldName in this.inputs ? fieldName : options.message;
|
|
133
|
+
return this.inputs[key];
|
|
134
|
+
}
|
|
135
|
+
this.response.fields.push({
|
|
136
|
+
type: "select",
|
|
137
|
+
name: fieldName,
|
|
138
|
+
message: options.message,
|
|
139
|
+
options: options.options.map((o) => ({
|
|
140
|
+
value: o.value,
|
|
141
|
+
label: o.label,
|
|
142
|
+
hint: o.hint,
|
|
143
|
+
})),
|
|
144
|
+
defaultValue: options.initialValue,
|
|
145
|
+
});
|
|
146
|
+
this.response.status = "needsInput";
|
|
147
|
+
throw new APIAdapterNeedsInputError(fieldName);
|
|
148
|
+
}
|
|
149
|
+
async multiSelect(options) {
|
|
150
|
+
const fieldName = `field_${this.fieldIndex++}`;
|
|
151
|
+
if (fieldName in this.inputs || options.message in this.inputs) {
|
|
152
|
+
const key = fieldName in this.inputs ? fieldName : options.message;
|
|
153
|
+
const value = this.inputs[key];
|
|
154
|
+
return Array.isArray(value) ? value : [value];
|
|
155
|
+
}
|
|
156
|
+
this.response.fields.push({
|
|
157
|
+
type: "multiSelect",
|
|
158
|
+
name: fieldName,
|
|
159
|
+
message: options.message,
|
|
160
|
+
options: options.options.map((o) => ({
|
|
161
|
+
value: o.value,
|
|
162
|
+
label: o.label,
|
|
163
|
+
hint: o.hint,
|
|
164
|
+
})),
|
|
165
|
+
defaultValue: options.initialValues,
|
|
166
|
+
required: options.required,
|
|
167
|
+
});
|
|
168
|
+
this.response.status = "needsInput";
|
|
169
|
+
throw new APIAdapterNeedsInputError(fieldName);
|
|
170
|
+
}
|
|
171
|
+
spinner(message) {
|
|
172
|
+
this.response.logs.push({ level: "info", message: `[spinner] ${message}`, timestamp: Date.now() });
|
|
173
|
+
return {
|
|
174
|
+
stop(msg) {
|
|
175
|
+
// No-op in API mode
|
|
176
|
+
},
|
|
177
|
+
message(_msg) {
|
|
178
|
+
// No-op in API mode
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// ============================================================================
|
|
184
|
+
// Error Types
|
|
185
|
+
// ============================================================================
|
|
186
|
+
/** Thrown when the adapter needs more input from the client */
|
|
187
|
+
class APIAdapterNeedsInputError extends Error {
|
|
188
|
+
fieldName;
|
|
189
|
+
constructor(fieldName) {
|
|
190
|
+
super(`Input required for field: ${fieldName}`);
|
|
191
|
+
this.fieldName = fieldName;
|
|
192
|
+
this.name = "APIAdapterNeedsInputError";
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
exports.APIAdapterNeedsInputError = APIAdapterNeedsInputError;
|
|
196
|
+
/** Thrown when validation fails on a provided input */
|
|
197
|
+
class APIAdapterValidationError extends Error {
|
|
198
|
+
fieldName;
|
|
199
|
+
validationMessage;
|
|
200
|
+
constructor(fieldName, validationMessage) {
|
|
201
|
+
super(`Validation failed for ${fieldName}: ${validationMessage}`);
|
|
202
|
+
this.fieldName = fieldName;
|
|
203
|
+
this.validationMessage = validationMessage;
|
|
204
|
+
this.name = "APIAdapterValidationError";
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.APIAdapterValidationError = APIAdapterValidationError;
|
|
208
|
+
/** Thrown when the operation is cancelled */
|
|
209
|
+
class APIAdapterCancelError extends Error {
|
|
210
|
+
constructor(message) {
|
|
211
|
+
super(message);
|
|
212
|
+
this.name = "APIAdapterCancelError";
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.APIAdapterCancelError = APIAdapterCancelError;
|
|
216
|
+
// ============================================================================
|
|
217
|
+
// Runtime Adapter
|
|
218
|
+
// ============================================================================
|
|
219
|
+
/**
|
|
220
|
+
* Create an API runtime adapter for HTTP request handling.
|
|
221
|
+
*
|
|
222
|
+
* @param inputs - Key-value pairs from the request body providing answers to wizard fields
|
|
223
|
+
* @returns A tuple of [RuntimeAdapter, APIResponse] — use the response to send back to the client
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* const [adapter, response] = createAPIAdapter({ field_0: "my-project", field_1: "aws" });
|
|
227
|
+
* try {
|
|
228
|
+
* await initTool(adapter, {});
|
|
229
|
+
* } catch (e) {
|
|
230
|
+
* if (e instanceof APIAdapterNeedsInputError) {
|
|
231
|
+
* // Return response.fields to client for more input
|
|
232
|
+
* }
|
|
233
|
+
* }
|
|
234
|
+
* res.json(response);
|
|
235
|
+
*/
|
|
236
|
+
function createAPIAdapter(inputs = {}) {
|
|
237
|
+
const response = {
|
|
238
|
+
fields: [],
|
|
239
|
+
logs: [],
|
|
240
|
+
messages: [],
|
|
241
|
+
status: "complete",
|
|
242
|
+
};
|
|
243
|
+
const adapter = {
|
|
244
|
+
ui: new APIUIAdapter(inputs, response),
|
|
245
|
+
exec: new APIExecAdapter(),
|
|
246
|
+
platform: "api",
|
|
247
|
+
};
|
|
248
|
+
return [adapter, response];
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=api-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,EAAE,UAAU;KACnB,CAAC;IAEF,MAAM,OAAO,GAAmB;QAC9B,EAAE,EAAE,IAAI,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC;QACtC,IAAI,EAAE,IAAI,cAAc,EAAE;QAC1B,QAAQ,EAAE,KAAK;KAChB,CAAC;IAEF,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Runtime Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements RuntimeAdapter for interactive terminal usage
|
|
5
|
+
* using @clack/prompts for UI and child_process for execution.
|
|
6
|
+
*/
|
|
7
|
+
import type { RuntimeAdapter } from "./types";
|
|
8
|
+
/**
|
|
9
|
+
* Create a CLI runtime adapter for interactive terminal usage
|
|
10
|
+
*/
|
|
11
|
+
export declare function createCLIAdapter(): RuntimeAdapter;
|
|
12
|
+
/**
|
|
13
|
+
* Singleton CLI adapter instance for convenience
|
|
14
|
+
*/
|
|
15
|
+
export declare const cliAdapter: RuntimeAdapter;
|