thinkwork-cli 0.7.0 → 0.8.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 CHANGED
@@ -20,8 +20,10 @@ npx thinkwork-cli --help
20
20
 
21
21
  ## Quick Start
22
22
 
23
+ ### Deploy a new stack
24
+
23
25
  ```bash
24
- # 1. Authenticate with AWS
26
+ # 1. Authenticate with AWS (profile picker, --sso, or --keys)
25
27
  thinkwork login
26
28
 
27
29
  # 2. Check prerequisites
@@ -43,6 +45,21 @@ thinkwork bootstrap -s dev
43
45
  thinkwork outputs -s dev
44
46
  ```
45
47
 
48
+ ### Sign in to the deployed stack
49
+
50
+ ```bash
51
+ # 8. Sign in to the Cognito user pool (opens browser; supports Google OAuth)
52
+ thinkwork login --stage dev
53
+
54
+ # 9. Verify identity + default tenant
55
+ thinkwork me
56
+
57
+ # 10. (CI only) non-interactive session with the api_auth_secret
58
+ thinkwork login --stage prod --api-key "$THINKWORK_API_KEY" --tenant acme
59
+ ```
60
+
61
+ After step 8, API-backed commands (`thinkwork thread list`, `thinkwork agent create`, etc.) resolve auth + tenant automatically from the stored session. The Cognito id-token refreshes in the background.
62
+
46
63
  No repo clone required — `thinkwork init` scaffolds all Terraform modules from the npm package.
47
64
 
48
65
  ## Commands
@@ -52,6 +69,10 @@ No repo clone required — `thinkwork init` scaffolds all Terraform modules from
52
69
  | Command | Description |
53
70
  |---------|-------------|
54
71
  | `thinkwork login` | Configure AWS credentials (access keys or `--sso`) |
72
+ | `thinkwork login --stage <s>` | Sign in to a deployed stack via Cognito (OAuth; Google supported). Caches tokens in `~/.thinkwork/config.json` |
73
+ | `thinkwork login --stage <s> --api-key <secret>` | Non-interactive CI path; stores the api_auth_secret as the session |
74
+ | `thinkwork logout [--stage <s> \| --all]` | Forget stored sessions |
75
+ | `thinkwork me [--stage <s>]` | Print who you're signed in as on a stage (verifies via a live `me` query) |
55
76
  | `thinkwork init -s <stage>` | Initialize a new environment — generates terraform.tfvars, scaffolds Terraform modules, runs `terraform init` |
56
77
  | `thinkwork doctor -s <stage>` | Check prerequisites (AWS CLI, Terraform, credentials, Bedrock access) |
57
78
 
@@ -80,14 +101,47 @@ No repo clone required — `thinkwork init` scaffolds all Terraform modules from
80
101
 
81
102
  ```
82
103
  -s, --stage <name> Deployment stage (required for most commands)
104
+ -t, --tenant <slug> Tenant (workspace) slug. Falls back to the cached default.
83
105
  -p, --profile <name> AWS profile to use
84
106
  -c, --component <tier> Component tier: foundation, data, app, or all (default: all)
85
107
  -y, --yes Skip confirmation prompts (for CI)
108
+ --json Emit machine-readable JSON on stdout (stderr for logs)
86
109
  --defaults Skip interactive prompts in init (use all defaults)
87
110
  -v, --version Print CLI version
88
111
  -h, --help Show help
89
112
  ```
90
113
 
114
+ The CLI has two modes for every API-backed command:
115
+
116
+ - **Flag-driven** — every field can be passed as a flag for scripting / agents.
117
+ Missing required flags in a non-TTY context exit 1 with a clear error.
118
+ - **Interactive walkthrough** — when running in a terminal, missing fields are
119
+ prompted via arrow-key pickers. `Ctrl+C` cancels cleanly.
120
+
121
+ Any flag accepted by a command is also inferrable from env vars:
122
+ `THINKWORK_STAGE`, `THINKWORK_TENANT`, `THINKWORK_API_KEY` (for CI).
123
+
124
+ ## Roadmap
125
+
126
+ The commands below are **scaffolded** in Phase 0 (help text + argument parsing
127
+ ships now, so `thinkwork --help` shows the full surface area) and fill in
128
+ phase-by-phase. Running a scaffolded command prints a "not yet implemented"
129
+ message and exits with code 2.
130
+
131
+ | Phase | Domain | Commands |
132
+ |-------|--------|----------|
133
+ | **0 (now)** | Foundation | `login` (Cognito + AWS), `logout`, `me`, `--json`, GraphQL client, codegen, shared helpers |
134
+ | 1 | Work & approvals | `thread`, `message`, `label`, `inbox` |
135
+ | 2 | Agents & workspace | `agent`, `template`, `tenant`, `member`, `team`, `kb` |
136
+ | 3 | Automation & integrations | `routine`, `scheduled-job`, `turn`, `wakeup`, `webhook`, `connector`, `skill` |
137
+ | 4 | Memory & artifacts | `memory`, `recipe`, `artifact` |
138
+ | 5 | Observability & spend | `cost`, `budget`, `performance`, `trace`, `dashboard` |
139
+
140
+ Each phase ships as one PR. Mid-phase stubs keep `thinkwork --help` complete
141
+ so the full surface is always discoverable; individual commands flip from
142
+ stub to real implementation as their phase lands. Run any
143
+ `thinkwork <cmd> --help` today to see the planned flags + examples.
144
+
91
145
  ## Interactive Init
92
146
 
93
147
  `thinkwork init` walks you through all configuration options:
@@ -162,9 +216,33 @@ thinkwork deploy -s dev --profile my-org
162
216
  ### CI/CD (non-interactive)
163
217
 
164
218
  ```bash
219
+ # Deploy side — uses AWS credentials from env / IAM role.
165
220
  thinkwork init -s prod --defaults
166
221
  thinkwork deploy -s prod -y
167
222
  thinkwork bootstrap -s prod
223
+
224
+ # API side — store the api_auth_secret as an api-key session and invoke
225
+ # commands without a browser / TTY.
226
+ thinkwork login --stage prod --api-key "$THINKWORK_API_KEY" --tenant "$THINKWORK_TENANT"
227
+ thinkwork thread list --status IN_PROGRESS --json | jq '.[].id'
228
+ ```
229
+
230
+ ### Pipe to jq
231
+
232
+ Every API-backed command accepts `--json` for machine-readable stdout. Warnings, spinners, and errors always go to stderr, so piping stays clean:
233
+
234
+ ```bash
235
+ thinkwork me --json | jq .tenantSlug
236
+ thinkwork agent list --status OFFLINE --json | jq '.[].name'
237
+ thinkwork cost summary --from 2026-04-01 --json | jq .totalUsd
238
+ ```
239
+
240
+ ### Forget a stored session
241
+
242
+ ```bash
243
+ thinkwork logout --stage dev # one stage
244
+ thinkwork logout --all # every stage
245
+ thinkwork logout # interactive picker
168
246
  ```
169
247
 
170
248
  ## Prerequisites