statelyai 0.6.1 → 0.7.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 +6 -5
- package/dist/bin.mjs +1 -1
- package/dist/{cli-jiby9qdf.mjs → cli-DR7_Qkzm.mjs} +35 -98
- package/dist/index.d.mts +4 -11
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ This package contains the `statelyai` command implementation.
|
|
|
13
13
|
statelyai login
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
Automation can set `STATELY_ACCESS_TOKEN` for OAuth
|
|
17
|
-
|
|
16
|
+
Automation can set `STATELY_ACCESS_TOKEN` for OAuth or `STATELY_API_KEY` for
|
|
17
|
+
API-key auth.
|
|
18
18
|
|
|
19
19
|
For a custom OAuth protected resource, discover OAuth from that resource:
|
|
20
20
|
|
|
@@ -23,9 +23,10 @@ statelyai login --base-url http://localhost:3000/registry/api/mcp
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
`statelyai login --auth bearer` uses the same browser OAuth flow explicitly.
|
|
26
|
-
`statelyai login --api-key`
|
|
27
|
-
`statelyai
|
|
28
|
-
|
|
26
|
+
`statelyai login --api-key` prompts securely for an API key, and
|
|
27
|
+
`statelyai login --stdin` reads an API key from standard input. All commands use
|
|
28
|
+
stored OAuth credentials or stored API keys. Free accounts open read-only
|
|
29
|
+
root-level views.
|
|
29
30
|
|
|
30
31
|
2. Initialize the current repo:
|
|
31
32
|
|
package/dist/bin.mjs
CHANGED
|
@@ -149,6 +149,10 @@ var RemoteEditorSession = class {
|
|
|
149
149
|
this.currentSourceLocations = update.sourceLocations;
|
|
150
150
|
this.editorSyncAccess = update.access;
|
|
151
151
|
this.updateSourceLocations(update.sourceLocations);
|
|
152
|
+
if (this.options.apiKey) this.sendMessage({
|
|
153
|
+
type: "@statelyai.setApiKey",
|
|
154
|
+
apiKey: this.options.apiKey
|
|
155
|
+
});
|
|
152
156
|
this.postMessage({
|
|
153
157
|
type: "@statelyai.init",
|
|
154
158
|
machine: update.machine,
|
|
@@ -370,10 +374,7 @@ async function openEditor(options) {
|
|
|
370
374
|
return;
|
|
371
375
|
}
|
|
372
376
|
response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
373
|
-
response.end(getCliWebviewContent({
|
|
374
|
-
editorUrl: options.editorUrl,
|
|
375
|
-
apiKey: options.apiKey
|
|
376
|
-
}));
|
|
377
|
+
response.end(getCliWebviewContent({ editorUrl: options.editorUrl }));
|
|
377
378
|
});
|
|
378
379
|
server.on("upgrade", (request, socket) => {
|
|
379
380
|
if (request.url !== "/ws") {
|
|
@@ -529,8 +530,6 @@ function watchWorkspace(rootDir, listener) {
|
|
|
529
530
|
}
|
|
530
531
|
function getCliWebviewContent(options) {
|
|
531
532
|
const baseUrl = normalizedBaseUrl(options.editorUrl);
|
|
532
|
-
const url = new URL(`${baseUrl}/embed`);
|
|
533
|
-
if (options.apiKey) url.searchParams.set("api_key", options.apiKey);
|
|
534
533
|
return `<!DOCTYPE html>
|
|
535
534
|
<html lang="en" style="height:100%;margin:0">
|
|
536
535
|
<head>
|
|
@@ -544,7 +543,7 @@ function getCliWebviewContent(options) {
|
|
|
544
543
|
<body>
|
|
545
544
|
<iframe
|
|
546
545
|
id="stately-editor"
|
|
547
|
-
src="${escapeAttribute(
|
|
546
|
+
src="${escapeAttribute(new URL(`${baseUrl}/embed`).toString())}"
|
|
548
547
|
allow="clipboard-read; clipboard-write"
|
|
549
548
|
></iframe>
|
|
550
549
|
<script>
|
|
@@ -718,15 +717,6 @@ function getCredentialsFilePath() {
|
|
|
718
717
|
function shouldUseFileBackendOnly() {
|
|
719
718
|
return process.env.STATELYAI_CREDENTIALS_BACKEND === "file" || process.env.STATELYAI_CONFIG_DIR !== void 0;
|
|
720
719
|
}
|
|
721
|
-
async function readFileCredentials() {
|
|
722
|
-
const storedCredential = await readFileStoredCredential();
|
|
723
|
-
if (storedCredential?.credential?.type !== "api_key") return;
|
|
724
|
-
return {
|
|
725
|
-
apiKey: storedCredential.credential.token,
|
|
726
|
-
backend: storedCredential.backend,
|
|
727
|
-
location: storedCredential.location
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
720
|
function parseStoredCredential(raw, backend, location) {
|
|
731
721
|
try {
|
|
732
722
|
const parsed = JSON.parse(raw);
|
|
@@ -831,15 +821,6 @@ async function deleteFileCredentials() {
|
|
|
831
821
|
return false;
|
|
832
822
|
}
|
|
833
823
|
}
|
|
834
|
-
async function readMacOSKeychain() {
|
|
835
|
-
const storedCredential = await readMacOSStoredCredential();
|
|
836
|
-
if (storedCredential?.credential?.type !== "api_key") return;
|
|
837
|
-
return {
|
|
838
|
-
apiKey: storedCredential.credential.token,
|
|
839
|
-
backend: storedCredential.backend,
|
|
840
|
-
location: storedCredential.location
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
824
|
async function readMacOSStoredCredential() {
|
|
844
825
|
if (process.platform !== "darwin") return;
|
|
845
826
|
try {
|
|
@@ -912,15 +893,6 @@ async function deleteMacOSKeychain() {
|
|
|
912
893
|
return false;
|
|
913
894
|
}
|
|
914
895
|
}
|
|
915
|
-
async function readLinuxSecretTool() {
|
|
916
|
-
const storedCredential = await readLinuxStoredCredential();
|
|
917
|
-
if (storedCredential?.credential?.type !== "api_key") return;
|
|
918
|
-
return {
|
|
919
|
-
apiKey: storedCredential.credential.token,
|
|
920
|
-
backend: storedCredential.backend,
|
|
921
|
-
location: storedCredential.location
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
896
|
async function readLinuxStoredCredential() {
|
|
925
897
|
if (process.platform !== "linux") return;
|
|
926
898
|
try {
|
|
@@ -991,10 +963,6 @@ async function deleteLinuxSecretTool() {
|
|
|
991
963
|
return false;
|
|
992
964
|
}
|
|
993
965
|
}
|
|
994
|
-
async function getStoredApiKey() {
|
|
995
|
-
if (shouldUseFileBackendOnly()) return readFileCredentials();
|
|
996
|
-
return await readMacOSKeychain() ?? await readLinuxSecretTool() ?? await readFileCredentials();
|
|
997
|
-
}
|
|
998
966
|
async function getStoredCredential() {
|
|
999
967
|
if (shouldUseFileBackendOnly()) return readFileStoredCredential();
|
|
1000
968
|
return await readMacOSStoredCredential() ?? await readLinuxStoredCredential() ?? await readFileStoredCredential();
|
|
@@ -1354,41 +1322,19 @@ function getEnvCredential() {
|
|
|
1354
1322
|
variable: "NEXT_PUBLIC_STATELY_API_KEY"
|
|
1355
1323
|
};
|
|
1356
1324
|
}
|
|
1357
|
-
async function resolveApiKey(
|
|
1358
|
-
if (explicitApiKey) return {
|
|
1359
|
-
apiKey: explicitApiKey,
|
|
1360
|
-
source: "flag",
|
|
1361
|
-
detail: "--api-key"
|
|
1362
|
-
};
|
|
1325
|
+
async function resolveApiKey() {
|
|
1363
1326
|
const envApiKey = getEnvApiKey();
|
|
1364
1327
|
if (envApiKey) return {
|
|
1365
1328
|
apiKey: envApiKey.apiKey,
|
|
1366
1329
|
source: "env",
|
|
1367
1330
|
detail: envApiKey.variable
|
|
1368
1331
|
};
|
|
1369
|
-
const storedApiKey = await getStoredApiKey();
|
|
1370
|
-
if (storedApiKey) return {
|
|
1371
|
-
apiKey: storedApiKey.apiKey,
|
|
1372
|
-
source: "stored",
|
|
1373
|
-
detail: describeCredentialBackend(storedApiKey.backend, storedApiKey.location)
|
|
1374
|
-
};
|
|
1375
|
-
return { source: "missing" };
|
|
1376
|
-
}
|
|
1377
|
-
async function resolveOAuthAccessToken() {
|
|
1378
|
-
const envCredential = getEnvCredential();
|
|
1379
|
-
if (envCredential?.credential.type === "oauth") return {
|
|
1380
|
-
apiKey: envCredential.credential.accessToken,
|
|
1381
|
-
source: "env",
|
|
1382
|
-
detail: envCredential.variable
|
|
1383
|
-
};
|
|
1384
|
-
if (envCredential?.credential.type === "api_key") throw new Error("`statelyai open` requires OAuth login. Run `statelyai login` instead of using an API key.");
|
|
1385
1332
|
const storedCredential = await getStoredCredential();
|
|
1386
|
-
if (storedCredential?.credential
|
|
1387
|
-
apiKey: storedCredential.credential.accessToken,
|
|
1333
|
+
if (storedCredential?.credential) return {
|
|
1334
|
+
apiKey: storedCredential.credential.type === "oauth" ? storedCredential.credential.accessToken : storedCredential.credential.token,
|
|
1388
1335
|
source: "stored",
|
|
1389
1336
|
detail: describeCredentialBackend(storedCredential.backend, storedCredential.location)
|
|
1390
1337
|
};
|
|
1391
|
-
if (storedCredential?.credential?.type === "api_key") throw new Error("`statelyai open` requires OAuth login. Run `statelyai login` to replace the stored API key.");
|
|
1392
1338
|
return { source: "missing" };
|
|
1393
1339
|
}
|
|
1394
1340
|
function getDefaultBaseUrl() {
|
|
@@ -1504,7 +1450,7 @@ async function readApiKeyFromStdin() {
|
|
|
1504
1450
|
return Buffer.concat(chunks).toString("utf8").trim();
|
|
1505
1451
|
}
|
|
1506
1452
|
async function promptForApiKey() {
|
|
1507
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY) throw new Error("No interactive terminal available.
|
|
1453
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) throw new Error("No interactive terminal available. Pipe the API key to `statelyai login --stdin`.");
|
|
1508
1454
|
const maskedOutput = new Writable({ write(chunk, _encoding, callback) {
|
|
1509
1455
|
if (!maskedOutput.muted) process.stdout.write(chunk);
|
|
1510
1456
|
callback();
|
|
@@ -1728,8 +1674,8 @@ function formatMissingNewMachineDirMessage(options) {
|
|
|
1728
1674
|
function toMachineFileStem(machineName) {
|
|
1729
1675
|
return (typeof machineName === "string" ? machineName : "").trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^A-Za-z0-9]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase() || "machine";
|
|
1730
1676
|
}
|
|
1731
|
-
function
|
|
1732
|
-
return `No
|
|
1677
|
+
function getMissingCredentialMessage() {
|
|
1678
|
+
return `No Stately credential configured. Run \`statelyai login\`, set \`STATELY_ACCESS_TOKEN\`, or set \`STATELY_API_KEY\`.\nGet or create an API key at ${STATELY_API_KEY_SETTINGS_URL}`;
|
|
1733
1679
|
}
|
|
1734
1680
|
function buildProjectEditorUrl(studioUrl, projectId) {
|
|
1735
1681
|
return `${studioUrl.replace(/\/+$/, "")}/registry/editor/${encodeURIComponent(projectId)}`;
|
|
@@ -1998,7 +1944,6 @@ const sharedFlags = {
|
|
|
1998
1944
|
default: false,
|
|
1999
1945
|
description: "Exit with a nonzero code when differences are found"
|
|
2000
1946
|
}),
|
|
2001
|
-
"api-key": Flags.string({ description: "Stately API key used for remote source or target resolution" }),
|
|
2002
1947
|
"base-url": Flags.string({ description: "Base URL for Stately Studio or a self-hosted deployment" })
|
|
2003
1948
|
};
|
|
2004
1949
|
function formatChangeList(label, items) {
|
|
@@ -2053,7 +1998,7 @@ var PlanCommand = class PlanCommand extends ParsedSyncCommand {
|
|
|
2053
1998
|
static args = sharedArgs;
|
|
2054
1999
|
async run() {
|
|
2055
2000
|
const { args, flags } = await this.parseSync(PlanCommand);
|
|
2056
|
-
const apiKey = (await resolveApiKey(
|
|
2001
|
+
const apiKey = (await resolveApiKey()).apiKey;
|
|
2057
2002
|
const plan = await planSync({
|
|
2058
2003
|
source: args.source,
|
|
2059
2004
|
target: args.target,
|
|
@@ -2070,7 +2015,7 @@ var DiffCommand = class DiffCommand extends ParsedSyncCommand {
|
|
|
2070
2015
|
static args = sharedArgs;
|
|
2071
2016
|
async run() {
|
|
2072
2017
|
const { args, flags } = await this.parseSync(DiffCommand);
|
|
2073
|
-
const apiKey = (await resolveApiKey(
|
|
2018
|
+
const apiKey = (await resolveApiKey()).apiKey;
|
|
2074
2019
|
const plan = await planSync({
|
|
2075
2020
|
source: args.source,
|
|
2076
2021
|
target: args.target,
|
|
@@ -2104,9 +2049,9 @@ var PullCommand = class PullCommand extends ParsedSyncCommand {
|
|
|
2104
2049
|
};
|
|
2105
2050
|
async run() {
|
|
2106
2051
|
const { args, flags } = await this.parseSync(PullCommand);
|
|
2107
|
-
const apiKey = (await resolveApiKey(
|
|
2052
|
+
const apiKey = (await resolveApiKey()).apiKey;
|
|
2108
2053
|
if (!args.source) {
|
|
2109
|
-
if (!apiKey) this.error(
|
|
2054
|
+
if (!apiKey) this.error(getMissingCredentialMessage());
|
|
2110
2055
|
this.log(colorize("Resolving configured project and linked source files...", ANSI_CYAN));
|
|
2111
2056
|
const { config, linkedTargets, project, remoteOnlyTargets, skipped, rewriteStatus } = await resolveConfiguredPullTargets({
|
|
2112
2057
|
apiKey,
|
|
@@ -2185,7 +2130,7 @@ var PullCommand = class PullCommand extends ParsedSyncCommand {
|
|
|
2185
2130
|
target = localCandidate;
|
|
2186
2131
|
}
|
|
2187
2132
|
if (!target) this.error("Missing target path. Pass `statelyai pull <machine-id|url> <file>` or `statelyai pull <linked-file>`.");
|
|
2188
|
-
if (!apiKey) this.error(
|
|
2133
|
+
if (!apiKey) this.error(getMissingCredentialMessage());
|
|
2189
2134
|
if (!flags.force && await fileExists(target) && await isFileGitDirty(target)) this.error(`Refusing to overwrite locally modified file ${target}. Pass --force to overwrite it.`);
|
|
2190
2135
|
this.log(colorize(`Pulling ${source} into ${target}...`, ANSI_CYAN));
|
|
2191
2136
|
const result = await pullSync({
|
|
@@ -2207,7 +2152,6 @@ var PushCommand = class PushCommand extends Command {
|
|
|
2207
2152
|
}) };
|
|
2208
2153
|
static flags = {
|
|
2209
2154
|
help: Flags.help({ char: "h" }),
|
|
2210
|
-
"api-key": Flags.string({ description: "Stately API key used to create or update remote machines" }),
|
|
2211
2155
|
"base-url": Flags.string({ description: "Base URL for Stately Studio or a self-hosted deployment" }),
|
|
2212
2156
|
config: Flags.string({ description: "Path to statelyai.json" }),
|
|
2213
2157
|
"dry-run": Flags.boolean({
|
|
@@ -2217,8 +2161,8 @@ var PushCommand = class PushCommand extends Command {
|
|
|
2217
2161
|
};
|
|
2218
2162
|
async run() {
|
|
2219
2163
|
const { args, flags } = await this.parse(PushCommand);
|
|
2220
|
-
const resolvedApiKey = flags["dry-run"] ? { source: "missing" } : await resolveApiKey(
|
|
2221
|
-
if (!flags["dry-run"] && !resolvedApiKey.apiKey) this.error(
|
|
2164
|
+
const resolvedApiKey = flags["dry-run"] ? { source: "missing" } : await resolveApiKey();
|
|
2165
|
+
if (!flags["dry-run"] && !resolvedApiKey.apiKey) this.error(getMissingCredentialMessage());
|
|
2222
2166
|
this.log(colorize("Resolving configured project and source files...", ANSI_CYAN));
|
|
2223
2167
|
const { client, config, files, rewriteStatus } = flags["dry-run"] ? await (async () => {
|
|
2224
2168
|
const { config, rootDir, rewriteStatus } = await readStatelyProjectConfig({
|
|
@@ -2333,7 +2277,6 @@ var OpenCommand = class OpenCommand extends Command {
|
|
|
2333
2277
|
}) };
|
|
2334
2278
|
static flags = {
|
|
2335
2279
|
help: Flags.help({ char: "h" }),
|
|
2336
|
-
"api-key": Flags.string({ description: "Deprecated. `statelyai open` requires OAuth login." }),
|
|
2337
2280
|
"editor-url": Flags.string({ description: "Base URL for the Stately editor embed" }),
|
|
2338
2281
|
host: Flags.string({
|
|
2339
2282
|
description: "Local server host",
|
|
@@ -2356,9 +2299,8 @@ var OpenCommand = class OpenCommand extends Command {
|
|
|
2356
2299
|
};
|
|
2357
2300
|
async run() {
|
|
2358
2301
|
const { args, flags } = await this.parse(OpenCommand);
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
if (!apiKey) throw new Error("`statelyai open` requires OAuth login. Run `statelyai login` and retry.");
|
|
2302
|
+
const apiKey = (await resolveApiKey()).apiKey;
|
|
2303
|
+
if (!apiKey) throw new Error("No Stately credential configured. Run `statelyai login` and retry.");
|
|
2362
2304
|
await openEditor({
|
|
2363
2305
|
fileName: path.resolve(args.file),
|
|
2364
2306
|
editorUrl: flags["editor-url"] ?? getDefaultEditorUrl(),
|
|
@@ -2376,7 +2318,6 @@ var InitCommand = class InitCommand extends Command {
|
|
|
2376
2318
|
static description = "Creates or reuses a remote Studio project for the current working directory and writes a local statelyai.json configuration file.";
|
|
2377
2319
|
static flags = {
|
|
2378
2320
|
help: Flags.help({ char: "h" }),
|
|
2379
|
-
"api-key": Flags.string({ description: "Stately API key used to create the remote project" }),
|
|
2380
2321
|
"base-url": Flags.string({ description: "Base URL for Stately Studio or a self-hosted deployment" }),
|
|
2381
2322
|
name: Flags.string({ description: "Project name to create remotely" }),
|
|
2382
2323
|
visibility: Flags.string({
|
|
@@ -2399,8 +2340,8 @@ var InitCommand = class InitCommand extends Command {
|
|
|
2399
2340
|
};
|
|
2400
2341
|
async run() {
|
|
2401
2342
|
const { flags } = await this.parse(InitCommand);
|
|
2402
|
-
const resolvedApiKey = await resolveApiKey(
|
|
2403
|
-
if (!resolvedApiKey.apiKey) this.error(
|
|
2343
|
+
const resolvedApiKey = await resolveApiKey();
|
|
2344
|
+
if (!resolvedApiKey.apiKey) this.error(getMissingCredentialMessage());
|
|
2404
2345
|
this.log("Creating or reusing remote project...");
|
|
2405
2346
|
const result = await initProject({
|
|
2406
2347
|
apiKey: resolvedApiKey.apiKey,
|
|
@@ -2447,7 +2388,7 @@ var LoginCommand = class LoginCommand extends Command {
|
|
|
2447
2388
|
static description = "Stores Stately credentials in the OS credential store when available, with a private file fallback.";
|
|
2448
2389
|
static flags = {
|
|
2449
2390
|
help: Flags.help({ char: "h" }),
|
|
2450
|
-
"api-key": Flags.
|
|
2391
|
+
"api-key": Flags.boolean({ description: "Prompt securely for an API key to store" }),
|
|
2451
2392
|
"base-url": Flags.string({ description: "OAuth protected-resource URL for custom deployments" }),
|
|
2452
2393
|
stdin: Flags.boolean({
|
|
2453
2394
|
description: "Read the API key from standard input",
|
|
@@ -2460,7 +2401,7 @@ var LoginCommand = class LoginCommand extends Command {
|
|
|
2460
2401
|
};
|
|
2461
2402
|
async run() {
|
|
2462
2403
|
const { flags } = await this.parse(LoginCommand);
|
|
2463
|
-
if (flags["api-key"] && flags.auth === "bearer") this.error("Pass either --
|
|
2404
|
+
if ((flags["api-key"] || flags.stdin) && flags.auth === "bearer") this.error("Pass either --auth bearer or API-key login flags, not both.");
|
|
2464
2405
|
if (flags.auth === "none") {
|
|
2465
2406
|
if (flags.stdin || flags["api-key"]) this.error("Pass either --auth none or an API key, not both.");
|
|
2466
2407
|
const stored = await setStoredNoAuth();
|
|
@@ -2476,34 +2417,30 @@ var LoginCommand = class LoginCommand extends Command {
|
|
|
2476
2417
|
return;
|
|
2477
2418
|
}
|
|
2478
2419
|
if (flags.stdin && flags["api-key"]) this.error("Pass either --api-key or --stdin, not both.");
|
|
2479
|
-
|
|
2480
|
-
const apiKey = normalizeApiKey(flags["api-key"] ?? (!process.stdin.isTTY || flags.stdin ? await readApiKeyFromStdin() : await promptForApiKey()));
|
|
2420
|
+
const apiKey = normalizeApiKey(flags.stdin ? await readApiKeyFromStdin() : await promptForApiKey());
|
|
2481
2421
|
if (!apiKey) this.error(`API key cannot be empty.\nGet or create an API key at ${STATELY_API_KEY_SETTINGS_URL}`);
|
|
2482
|
-
const stored =
|
|
2483
|
-
type: "api_key",
|
|
2484
|
-
token: apiKey
|
|
2485
|
-
});
|
|
2422
|
+
const stored = await setStoredApiKey(apiKey);
|
|
2486
2423
|
this.log(`Stored API key in ${describeCredentialBackend(stored.backend, stored.location)}.`);
|
|
2487
2424
|
}
|
|
2488
2425
|
};
|
|
2489
2426
|
var LogoutCommand = class extends Command {
|
|
2490
2427
|
static enableJsonFlag = false;
|
|
2491
|
-
static summary = "Remove
|
|
2492
|
-
static description = "Deletes
|
|
2428
|
+
static summary = "Remove credentials stored by the CLI.";
|
|
2429
|
+
static description = "Deletes locally stored credentials. Environment variables are not changed.";
|
|
2493
2430
|
static flags = { help: Flags.help({ char: "h" }) };
|
|
2494
2431
|
async run() {
|
|
2495
2432
|
const result = await deleteStoredApiKey();
|
|
2496
2433
|
if (!result.deleted) {
|
|
2497
|
-
this.log("No stored
|
|
2434
|
+
this.log("No stored credential found.");
|
|
2498
2435
|
return;
|
|
2499
2436
|
}
|
|
2500
|
-
this.log(`Removed stored
|
|
2437
|
+
this.log(`Removed stored credential from ${result.locations.join(", ")}.`);
|
|
2501
2438
|
}
|
|
2502
2439
|
};
|
|
2503
2440
|
var WhoamiCommand = class extends Command {
|
|
2504
2441
|
static enableJsonFlag = false;
|
|
2505
|
-
static summary = "Show how the CLI would resolve
|
|
2506
|
-
static description = "Reports whether the CLI would use
|
|
2442
|
+
static summary = "Show how the CLI would resolve credentials.";
|
|
2443
|
+
static description = "Reports whether the CLI would use an environment variable or stored credential.";
|
|
2507
2444
|
static flags = { help: Flags.help({ char: "h" }) };
|
|
2508
2445
|
async run() {
|
|
2509
2446
|
const envCredential = getEnvCredential();
|
|
@@ -2522,7 +2459,7 @@ var WhoamiCommand = class extends Command {
|
|
|
2522
2459
|
this.log(formatStoredCredentialSource(storedCredential));
|
|
2523
2460
|
return;
|
|
2524
2461
|
}
|
|
2525
|
-
this.log(
|
|
2462
|
+
this.log(getMissingCredentialMessage());
|
|
2526
2463
|
}
|
|
2527
2464
|
};
|
|
2528
2465
|
const COMMANDS = {
|
|
@@ -2558,4 +2495,4 @@ function isDirectExecution() {
|
|
|
2558
2495
|
if (isDirectExecution()) run$1();
|
|
2559
2496
|
|
|
2560
2497
|
//#endregion
|
|
2561
|
-
export {
|
|
2498
|
+
export { run$1 as _, discoverOAuthLogin as a, formatPlanSummary as c, getEnvCredential as d, inferInitProjectName as f, resolveConfiguredPullTargets as g, resolveApiKey as h, discoverLinkedPullTargets as i, formatStoredCredentialSource as l, isFileGitDirty as m, buildOAuthLoginStart as n, discoverRemoteProjectMachineTargets as o, initProject as p, classifyPushCandidates as r, formatMissingNewMachineDirMessage as s, COMMANDS as t, getEnvApiKey as u, scanProjectSources as v, createStatelyProjectConfig as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -100,7 +100,7 @@ interface ResolvedConfiguredPullTargets {
|
|
|
100
100
|
type ApiKeyResolution = {
|
|
101
101
|
apiKey: string;
|
|
102
102
|
detail: string;
|
|
103
|
-
source: 'env' | '
|
|
103
|
+
source: 'env' | 'stored';
|
|
104
104
|
} | {
|
|
105
105
|
apiKey?: undefined;
|
|
106
106
|
detail?: undefined;
|
|
@@ -114,8 +114,7 @@ declare function getEnvCredential(): {
|
|
|
114
114
|
credential: StatelyCredential;
|
|
115
115
|
variable: 'NEXT_PUBLIC_STATELY_API_KEY' | 'STATELY_API_KEY' | 'STATELY_ACCESS_TOKEN';
|
|
116
116
|
} | undefined;
|
|
117
|
-
declare function resolveApiKey(
|
|
118
|
-
declare function resolveOAuthAccessToken(): Promise<ApiKeyResolution>;
|
|
117
|
+
declare function resolveApiKey(): Promise<ApiKeyResolution>;
|
|
119
118
|
interface OAuthLoginDiscovery {
|
|
120
119
|
authorizationServer: OAuthAuthorizationServerMetadata;
|
|
121
120
|
authorizationEndpoint: string;
|
|
@@ -173,7 +172,6 @@ declare abstract class BaseSyncCommand extends Command {
|
|
|
173
172
|
static flags: {
|
|
174
173
|
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
175
174
|
'fail-on-changes': _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
176
|
-
'api-key': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
177
175
|
'base-url': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
178
176
|
};
|
|
179
177
|
}
|
|
@@ -181,7 +179,6 @@ declare abstract class ParsedSyncCommand extends BaseSyncCommand {
|
|
|
181
179
|
protected parseSync<T extends typeof BaseSyncCommand>(command: T): Promise<_oclif_core_interfaces0.ParserOutput<{
|
|
182
180
|
help: void;
|
|
183
181
|
'fail-on-changes': boolean;
|
|
184
|
-
'api-key': string | undefined;
|
|
185
182
|
'base-url': string | undefined;
|
|
186
183
|
}, {
|
|
187
184
|
[flag: string]: any;
|
|
@@ -215,7 +212,6 @@ declare class PullCommand extends ParsedSyncCommand {
|
|
|
215
212
|
force: _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
216
213
|
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
217
214
|
'fail-on-changes': _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
218
|
-
'api-key': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
219
215
|
'base-url': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
220
216
|
};
|
|
221
217
|
static args: {
|
|
@@ -233,7 +229,6 @@ declare class PushCommand extends Command {
|
|
|
233
229
|
};
|
|
234
230
|
static flags: {
|
|
235
231
|
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
236
|
-
'api-key': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
237
232
|
'base-url': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
238
233
|
config: _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
239
234
|
'dry-run': _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
@@ -249,7 +244,6 @@ declare class OpenCommand extends Command {
|
|
|
249
244
|
};
|
|
250
245
|
static flags: {
|
|
251
246
|
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
252
|
-
'api-key': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
253
247
|
'editor-url': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
254
248
|
host: _oclif_core_interfaces0.OptionFlag<string, _oclif_core_interfaces0.CustomOptions>;
|
|
255
249
|
port: _oclif_core_interfaces0.OptionFlag<number, _oclif_core_interfaces0.CustomOptions>;
|
|
@@ -264,7 +258,6 @@ declare class InitCommand extends Command {
|
|
|
264
258
|
static description: string;
|
|
265
259
|
static flags: {
|
|
266
260
|
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
267
|
-
'api-key': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
268
261
|
'base-url': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
269
262
|
name: _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
270
263
|
visibility: _oclif_core_interfaces0.OptionFlag<string, _oclif_core_interfaces0.CustomOptions>;
|
|
@@ -279,7 +272,7 @@ declare class LoginCommand extends Command {
|
|
|
279
272
|
static description: string;
|
|
280
273
|
static flags: {
|
|
281
274
|
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
282
|
-
'api-key': _oclif_core_interfaces0.
|
|
275
|
+
'api-key': _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
283
276
|
'base-url': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
284
277
|
stdin: _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
285
278
|
auth: _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
@@ -317,4 +310,4 @@ declare const COMMANDS: {
|
|
|
317
310
|
};
|
|
318
311
|
declare function run(argv?: any, entryUrl?: string): Promise<void>;
|
|
319
312
|
//#endregion
|
|
320
|
-
export { ApiKeyResolution, COMMANDS, InitProjectOptions, InitProjectResult, LinkedPullTarget, OAuthLoginDiscovery, PushCandidateClassification, RemoteProjectMachineTarget, ResolvedConfiguredPullTargets, ScanProjectSourcesOptions, buildOAuthLoginStart, classifyPushCandidates, createStatelyProjectConfig, discoverLinkedPullTargets, discoverOAuthLogin, discoverRemoteProjectMachineTargets, formatMissingNewMachineDirMessage, formatPlanSummary, formatStoredCredentialSource, getEnvApiKey, getEnvCredential, inferInitProjectName, initProject, isFileGitDirty, resolveApiKey, resolveConfiguredPullTargets,
|
|
313
|
+
export { ApiKeyResolution, COMMANDS, InitProjectOptions, InitProjectResult, LinkedPullTarget, OAuthLoginDiscovery, PushCandidateClassification, RemoteProjectMachineTarget, ResolvedConfiguredPullTargets, ScanProjectSourcesOptions, buildOAuthLoginStart, classifyPushCandidates, createStatelyProjectConfig, discoverLinkedPullTargets, discoverOAuthLogin, discoverRemoteProjectMachineTargets, formatMissingNewMachineDirMessage, formatPlanSummary, formatStoredCredentialSource, getEnvApiKey, getEnvCredential, inferInitProjectName, initProject, isFileGitDirty, resolveApiKey, resolveConfiguredPullTargets, run, scanProjectSources };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as run, a as discoverOAuthLogin, c as formatPlanSummary, d as getEnvCredential, f as inferInitProjectName, g as resolveConfiguredPullTargets, h as resolveApiKey, i as discoverLinkedPullTargets, l as formatStoredCredentialSource, m as isFileGitDirty, n as buildOAuthLoginStart, o as discoverRemoteProjectMachineTargets, p as initProject, r as classifyPushCandidates, s as formatMissingNewMachineDirMessage, t as COMMANDS, u as getEnvApiKey, v as scanProjectSources, y as createStatelyProjectConfig } from "./cli-DR7_Qkzm.mjs";
|
|
2
2
|
|
|
3
|
-
export { COMMANDS, buildOAuthLoginStart, classifyPushCandidates, createStatelyProjectConfig, discoverLinkedPullTargets, discoverOAuthLogin, discoverRemoteProjectMachineTargets, formatMissingNewMachineDirMessage, formatPlanSummary, formatStoredCredentialSource, getEnvApiKey, getEnvCredential, inferInitProjectName, initProject, isFileGitDirty, resolveApiKey, resolveConfiguredPullTargets,
|
|
3
|
+
export { COMMANDS, buildOAuthLoginStart, classifyPushCandidates, createStatelyProjectConfig, discoverLinkedPullTargets, discoverOAuthLogin, discoverRemoteProjectMachineTargets, formatMissingNewMachineDirMessage, formatPlanSummary, formatStoredCredentialSource, getEnvApiKey, getEnvCredential, inferInitProjectName, initProject, isFileGitDirty, resolveApiKey, resolveConfiguredPullTargets, run, scanProjectSources };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "statelyai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Command-line tools for Stately",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@oclif/core": "^4.10.3",
|
|
24
|
-
"@statelyai/sdk": "0.12.
|
|
24
|
+
"@statelyai/sdk": "0.12.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"tsdown": "0.21.0-beta.2",
|