thinkwork-cli 0.12.8 → 0.12.10

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
@@ -137,26 +137,31 @@ The CLI has two modes for every API-backed command:
137
137
  Any flag accepted by a command is also inferrable from env vars:
138
138
  `THINKWORK_STAGE`, `THINKWORK_TENANT`, `THINKWORK_API_KEY` (for CI).
139
139
 
140
- ## Roadmap
140
+ ## Command surface
141
141
 
142
- The commands below are **scaffolded** in Phase 0 (help text + argument parsing
143
- ships now, so `thinkwork --help` shows the full surface area) and fill in
144
- phase-by-phase. Running a scaffolded command prints a "not yet implemented"
145
- message and exits with code 2.
142
+ All 25 originally-scaffolded commands across Phases 1–5 are now live.
143
+ `thinkwork <cmd> --help` is authoritative for flags + examples.
146
144
 
147
145
  | Phase | Domain | Commands |
148
146
  |-------|--------|----------|
149
- | **0 (now)** | Foundation | `login` (Cognito + AWS), `logout`, `me`, `--json`, GraphQL client, codegen, shared helpers |
150
- | 1 | Work & approvals | `thread`, `message`, `label`, `inbox` — **Phase 1 complete** |
151
- | 2 | Agents & workspace | `member`, `team`, `kb`, `template`, `tenant`, `agent` — **Phase 2 complete** |
152
- | 3 | Automation & integrations | `routine`, `scheduled-job`, `turn`, `wakeup`, `webhook`, `skill` — **Phase 3 complete** (`connector` retired) |
153
- | 4 | Memory & artifacts | `memory`, `recipe`, `artifact` — **Phase 4 complete** |
154
- | 5 | Observability & spend | `cost`, `budget`, `performance`, `trace`, `dashboard` — **Phase 5 complete** |
155
-
156
- Each phase ships as one PR. Mid-phase stubs keep `thinkwork --help` complete
157
- so the full surface is always discoverable; individual commands flip from
158
- stub to real implementation as their phase lands. Run any
159
- `thinkwork <cmd> --help` today to see the planned flags + examples.
147
+ | 0 | Foundation | `login` (chains AWS profile + Cognito API session), `logout`, `me`, `--json`, GraphQL client, codegen, shared helpers |
148
+ | 1 | Work & approvals | `thread`, `message`, `label`, `inbox` |
149
+ | 2 | Agents & workspace | `member`, `team`, `kb`, `template`, `tenant`, `agent` |
150
+ | 3 | Automation & integrations | `routine`, `scheduled-job`, `turn`, `wakeup`, `webhook`, `skill` (`connector` retired) |
151
+ | 4 | Memory & artifacts | `memory`, `recipe`, `artifact` |
152
+ | 5 | Observability & spend | `cost`, `budget`, `performance`, `trace`, `dashboard` |
153
+
154
+ `skill create` and `skill update` were retired in favor of
155
+ `thinkwork skill push <folder>` that's the real custom-skill authoring
156
+ surface. Invoking them prints "retired use `skill push`" and exits 2.
157
+
158
+ Auth model: the CLI's auto-fallback to the deploy-stage's
159
+ `api_auth_secret` admits most admin-tier paths via the server's
160
+ `requireAdminOrServiceCaller` gate. Paths that stamp a specific user
161
+ identity onto the row (`createThread`, `sendMessage`, `core/*` member
162
+ mutations) stay Cognito-required so service callers can't ghost-write
163
+ as a user — sign in via `thinkwork login --stage <s>` (or the chained
164
+ prompt from `thinkwork login`) for those.
160
165
 
161
166
  ## Interactive Init
162
167
 
@@ -5,7 +5,7 @@ import {
5
5
  readTfVar,
6
6
  resolveApiConfig,
7
7
  resolveTfvarsPath
8
- } from "./chunk-34NMB5AK.js";
8
+ } from "./chunk-JEHV35EU.js";
9
9
  export {
10
10
  apiFetch,
11
11
  apiFetchRaw,
@@ -43,6 +43,11 @@ function saveEnterpriseDeployment(config) {
43
43
  JSON.stringify(config, null, 2) + "\n"
44
44
  );
45
45
  }
46
+ function loadEnterpriseDeployment(customerSlug) {
47
+ const configPath = join(ENTERPRISE_DEPLOYMENTS_DIR, `${customerSlug}.json`);
48
+ if (!existsSync(configPath)) return null;
49
+ return JSON.parse(readFileSync(configPath, "utf-8"));
50
+ }
46
51
  function loadEnvironment(stage) {
47
52
  const configPath = join(ENVIRONMENTS_DIR, stage, "config.json");
48
53
  if (!existsSync(configPath)) return null;
@@ -176,6 +181,30 @@ function getApiEndpoint(stage, region) {
176
181
  );
177
182
  return raw && raw !== "None" ? raw : null;
178
183
  }
184
+ function discoverThinkworkStageUrls(stage, region) {
185
+ const urls = {};
186
+ const apiEndpoint = getApiEndpoint(stage, region);
187
+ if (apiEndpoint) urls.apiEndpoint = apiEndpoint;
188
+ const appSyncUrl = runAws(
189
+ `appsync list-graphql-apis --region ${region} --query "graphqlApis[?name=='thinkwork-${stage}-subscriptions'].uris.GRAPHQL|[0]" --output text`
190
+ );
191
+ if (appSyncUrl && appSyncUrl !== "None") urls.appSyncUrl = appSyncUrl;
192
+ const distributions = runAws(
193
+ `cloudfront list-distributions --query "DistributionList.Items[?contains(Origins.Items[0].DomainName, 'thinkwork-${stage}-')].{Origin:Origins.Items[0].DomainName,Domain:DomainName}" --output json`
194
+ );
195
+ if (distributions) {
196
+ const parsed = JSON.parse(distributions);
197
+ for (const distribution of parsed) {
198
+ if (distribution.Origin.includes(`thinkwork-${stage}-admin`)) {
199
+ urls.adminUrl = `https://${distribution.Domain}`;
200
+ }
201
+ if (distribution.Origin.includes(`thinkwork-${stage}-docs`)) {
202
+ urls.docsUrl = `https://${distribution.Domain}`;
203
+ }
204
+ }
205
+ }
206
+ return urls;
207
+ }
179
208
  function getApiAuthSecretFromLambda(stage, region) {
180
209
  const raw = runAws(
181
210
  `lambda get-function-configuration --function-name thinkwork-${stage}-api-tenants --region ${region} --query "Environment.Variables.API_AUTH_SECRET" --output text`
@@ -345,8 +374,10 @@ export {
345
374
  printSummary,
346
375
  listDeployedStages,
347
376
  getApiEndpoint,
377
+ discoverThinkworkStageUrls,
348
378
  saveEnvironment,
349
379
  saveEnterpriseDeployment,
380
+ loadEnterpriseDeployment,
350
381
  loadEnvironment,
351
382
  listEnvironments,
352
383
  resolveTerraformDir,