@kweaver-ai/kweaver-sdk 0.8.2 → 0.8.3
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 +26 -52
- package/README.zh.md +27 -46
- package/dist/api/resources.d.ts +94 -0
- package/dist/api/resources.js +166 -0
- package/dist/cli.js +102 -10
- package/dist/client.d.ts +3 -3
- package/dist/client.js +5 -5
- package/dist/commands/agent-members.js +27 -11
- package/dist/commands/agent.js +383 -272
- package/dist/commands/auth.js +184 -71
- package/dist/commands/bkn-metric.js +37 -16
- package/dist/commands/bkn-ops.js +164 -86
- package/dist/commands/bkn-query.js +99 -31
- package/dist/commands/bkn-schema.d.ts +3 -3
- package/dist/commands/bkn-schema.js +127 -86
- package/dist/commands/bkn.js +153 -114
- package/dist/commands/call.js +23 -13
- package/dist/commands/config.js +22 -12
- package/dist/commands/context-loader.js +98 -92
- package/dist/commands/dataflow.js +14 -6
- package/dist/commands/ds.js +52 -30
- package/dist/commands/explore.js +18 -15
- package/dist/commands/model.js +53 -42
- package/dist/commands/resource.d.ts +1 -0
- package/dist/commands/{dataview.js → resource.js} +62 -84
- package/dist/commands/skill.js +201 -65
- package/dist/commands/token.js +11 -0
- package/dist/commands/tool.js +46 -29
- package/dist/commands/toolbox.js +31 -15
- package/dist/commands/vega.js +466 -250
- package/dist/help/format.d.ts +65 -0
- package/dist/help/format.js +141 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/resources/{dataviews.d.ts → resources.d.ts} +10 -11
- package/dist/resources/{dataviews.js → resources.js} +12 -13
- package/package.json +1 -1
- package/dist/api/dataviews.d.ts +0 -117
- package/dist/api/dataviews.js +0 -265
- package/dist/commands/dataview.d.ts +0 -8
package/dist/commands/auth.js
CHANGED
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
import { isNoAuth } from "../config/no-auth.js";
|
|
2
2
|
import { assertNotStatelessForWrite } from "../config/stateless.js";
|
|
3
|
+
import { renderHelp } from "../help/format.js";
|
|
4
|
+
const AUTH_HELP = renderHelp({
|
|
5
|
+
tagline: "Login, list, inspect, and switch saved platform auth profiles",
|
|
6
|
+
usage: [
|
|
7
|
+
"kweaver auth <platform-url> [flags] (shorthand for `login`)",
|
|
8
|
+
"kweaver auth <subcommand> [args] [flags]",
|
|
9
|
+
],
|
|
10
|
+
sections: [
|
|
11
|
+
{
|
|
12
|
+
title: "AVAILABLE COMMANDS",
|
|
13
|
+
items: [
|
|
14
|
+
{ name: "login", desc: "Login to a platform (browser OAuth2 by default)" },
|
|
15
|
+
{ name: "whoami", desc: "Show current user identity (from id_token)" },
|
|
16
|
+
{ name: "status", desc: "Show current auth status" },
|
|
17
|
+
{ name: "list", desc: "List all platforms and users (tree view)" },
|
|
18
|
+
{ name: "use", desc: "Switch active platform" },
|
|
19
|
+
{ name: "users", desc: "List user profiles for a platform" },
|
|
20
|
+
{ name: "switch", desc: "Switch active user for a platform" },
|
|
21
|
+
{ name: "logout", desc: "Logout — clear local token" },
|
|
22
|
+
{ name: "delete", desc: "Delete saved credentials" },
|
|
23
|
+
{ name: "export", desc: "Export credentials (run printed command on headless host)" },
|
|
24
|
+
{ name: "change-password", desc: "Change password (interactive or with -u/-o/-n)" },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
flags: [
|
|
29
|
+
{
|
|
30
|
+
title: "Login",
|
|
31
|
+
flags: [
|
|
32
|
+
{ name: "--alias <name>", desc: "Save platform with a short alias" },
|
|
33
|
+
{ name: "--no-browser", desc: "Print auth URL, prompt for callback URL / code on stdin" },
|
|
34
|
+
{ name: "--no-auth", desc: "Save platform without OAuth (servers with no auth)" },
|
|
35
|
+
{ name: "--http-signin", desc: "Force HTTP /oauth2/signin (no browser)" },
|
|
36
|
+
{ name: "-u, --username <name>", desc: "Username for HTTP signin (prompts for missing pass)" },
|
|
37
|
+
{ name: "-p, --password <pwd>", desc: "Password for HTTP signin (prompts if -u given but -p omitted)" },
|
|
38
|
+
{ name: "--new-password <pwd>", desc: "Initial-password reset after 401001017, then retry login" },
|
|
39
|
+
{ name: "--client-id ID", desc: "Use existing OAuth2 client ID (skip dynamic registration)" },
|
|
40
|
+
{ name: "--client-secret S", desc: "Client secret (omit for public/PKCE clients)" },
|
|
41
|
+
{ name: "--refresh-token T", desc: "Headless: exchange refresh token for access token" },
|
|
42
|
+
{ name: "--port <n>", desc: "Local callback port (default: 9010)" },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: "TLS",
|
|
47
|
+
flags: [
|
|
48
|
+
{ name: "--insecure, -k", desc: "Skip TLS certificate verification (dev / self-signed only)" },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: "Scope",
|
|
53
|
+
flags: [
|
|
54
|
+
{ name: "--global", desc: "Override profile requirement for `switch`/`use` (CI / single-user setup)" },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
59
|
+
environment: [
|
|
60
|
+
{ name: "KWEAVER_PROFILE", desc: "Scope state.json (active platform/user) to a named profile" },
|
|
61
|
+
{ name: "KWEAVERC_CONFIG_DIR", desc: "Override config root (~/.kweaver) — hard isolation per shell" },
|
|
62
|
+
],
|
|
63
|
+
examples: [
|
|
64
|
+
"kweaver auth https://platform.example.com",
|
|
65
|
+
"kweaver auth login https://platform.example.com --client-id <id> --refresh-token <t>",
|
|
66
|
+
"kweaver auth switch --user alice",
|
|
67
|
+
"kweaver auth whoami --json",
|
|
68
|
+
],
|
|
69
|
+
learnMore: [
|
|
70
|
+
"For agents / multi-terminal scripts: prefer `--user <id>` over `auth switch`",
|
|
71
|
+
"Use `kweaver auth <subcommand> --help` for action-level details",
|
|
72
|
+
],
|
|
73
|
+
});
|
|
3
74
|
import { autoSelectBusinessDomain, clearPlatformSession, deletePlatform, deleteUser, getActiveUser, getConfigDir, getCurrentPlatform, getPlatformAlias, getProfileName, hasPlatform, listPlatforms, listUserProfiles, loadClientConfig, loadTokenConfig, loadUserTokenConfig, resolveBusinessDomain, resolvePlatformIdentifier, resolveUserId, saveNoAuthPlatform, setActiveUser, setCurrentPlatform, setPlatformAlias, } from "../config/store.js";
|
|
4
75
|
import { decodeJwtPayload } from "../config/jwt.js";
|
|
5
76
|
import { eacpModifyPassword } from "../auth/eacp-modify-password.js";
|
|
@@ -30,43 +101,62 @@ export async function runAuthCommand(args) {
|
|
|
30
101
|
const target = args[0];
|
|
31
102
|
const rest = args.slice(1);
|
|
32
103
|
if (!target || target === "--help" || target === "-h") {
|
|
33
|
-
console.log(
|
|
34
|
-
kweaver auth <url> Login (shorthand; same options as login)
|
|
35
|
-
kweaver auth whoami [url|alias] [--json] Show current user identity (from id_token)
|
|
36
|
-
kweaver auth export [url|alias] [--json] Export credentials; run printed command on a headless host
|
|
37
|
-
kweaver auth status [url|alias] Show current auth status
|
|
38
|
-
kweaver auth list List all platforms and users (tree view)
|
|
39
|
-
kweaver auth use <url|alias> Switch active platform
|
|
40
|
-
kweaver auth users [url|alias] List all user profiles (with usernames) for a platform
|
|
41
|
-
kweaver auth switch [url|alias] --user <id|username> Switch active user for a platform
|
|
42
|
-
kweaver auth logout [url|alias] [--user <id>] Logout (clear local token)
|
|
43
|
-
kweaver auth delete <url|alias> [--user <id>] Delete saved credentials
|
|
44
|
-
kweaver auth change-password [<url>] [-u <account>] [-o <old>] [-n <new>] Change password
|
|
45
|
-
|
|
46
|
-
Login options:
|
|
47
|
-
--alias <name> Save platform with a short alias (use with use / status / logout)
|
|
48
|
-
--client-id <id> Use an existing OAuth2 client ID instead of registering a new one.
|
|
49
|
-
Use the platform's web app client ID to get the same permissions
|
|
50
|
-
as the browser. Find it in DevTools: /oauth2/auth?client_id=<id>
|
|
51
|
-
--client-secret <s> Client secret (omit for public/PKCE clients)
|
|
52
|
-
--refresh-token <t> Use on a machine without a browser: exchange refresh token for access token.
|
|
53
|
-
Requires --client-id and --client-secret.
|
|
54
|
-
Get these from the callback page after browser login or \`auth export\`.
|
|
55
|
-
--port <n> Local callback port (default: 9010). Use when 9010 is occupied.
|
|
56
|
-
--no-browser Do not open a browser. Without -u/-p: print the auth URL and prompt for the
|
|
57
|
-
callback URL or code (stdin). With -u and/or -p: route through HTTP sign-in
|
|
58
|
-
(any missing credential is prompted; password is hidden when stdin is a TTY).
|
|
59
|
-
-u, --username Username for HTTP /oauth2/signin (POST). If -p is omitted, password is prompted.
|
|
60
|
-
-p, --password Password for HTTP /oauth2/signin (POST). If -u is omitted, username is prompted.
|
|
61
|
-
--http-signin Force HTTP /oauth2/signin (no browser). Missing -u/-p are prompted from stdin.
|
|
62
|
-
--new-password <pwd> After HTTP sign-in error 401001017 (initial password), set the new password non-interactively, then retry login.
|
|
63
|
-
--insecure, -k Skip TLS certificate verification (self-signed / dev HTTPS only)
|
|
64
|
-
--no-auth Save platform without OAuth (servers with no authentication). Same as detecting OAuth 404 during login.`);
|
|
104
|
+
console.log(AUTH_HELP);
|
|
65
105
|
return 0;
|
|
66
106
|
}
|
|
67
107
|
if (target === "login") {
|
|
68
108
|
if (rest[0] === "--help" || rest[0] === "-h") {
|
|
69
|
-
console.log(
|
|
109
|
+
console.log(renderHelp({
|
|
110
|
+
tagline: "Log in to a platform (browser OAuth2 by default)",
|
|
111
|
+
usage: [
|
|
112
|
+
"kweaver auth login <platform-url> [flags]",
|
|
113
|
+
"kweaver auth <platform-url> [flags] (shorthand)",
|
|
114
|
+
],
|
|
115
|
+
flags: [
|
|
116
|
+
{
|
|
117
|
+
title: "Save",
|
|
118
|
+
flags: [
|
|
119
|
+
{ name: "--alias <name>", desc: "Save platform with a short alias" },
|
|
120
|
+
{ name: "--no-auth", desc: "Save platform without OAuth (no-auth servers)" },
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
title: "Browser-less login",
|
|
125
|
+
flags: [
|
|
126
|
+
{ name: "--no-browser", desc: "Print auth URL, prompt for callback URL / code on stdin" },
|
|
127
|
+
{ name: "--http-signin", desc: "Force HTTP /oauth2/signin (no browser)" },
|
|
128
|
+
{ name: "-u, --username <name>", desc: "Username for HTTP signin" },
|
|
129
|
+
{ name: "-p, --password <pwd>", desc: "Password for HTTP signin (prompts if omitted but -u given)" },
|
|
130
|
+
{ name: "--new-password <pwd>", desc: "Reset initial password after 401001017, then retry login" },
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
title: "Headless (CI / servers)",
|
|
135
|
+
flags: [
|
|
136
|
+
{ name: "--client-id <id>", desc: "Use existing OAuth2 client ID (skip dynamic registration)" },
|
|
137
|
+
{ name: "--client-secret <s>", desc: "Client secret (omit for public/PKCE clients)" },
|
|
138
|
+
{ name: "--refresh-token <t>", desc: "Exchange refresh token for access token (with --client-id/--client-secret)" },
|
|
139
|
+
{ name: "--port <n>", desc: "Local callback port (default: 9010)" },
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
title: "TLS",
|
|
144
|
+
flags: [
|
|
145
|
+
{ name: "--insecure, -k", desc: "Skip TLS certificate verification (dev / self-signed only)" },
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
150
|
+
examples: [
|
|
151
|
+
"kweaver auth login https://platform.example.com",
|
|
152
|
+
"kweaver auth login https://platform.example.com --alias prod -u alice",
|
|
153
|
+
"kweaver auth login https://platform.example.com --client-id <id> --client-secret <s> --refresh-token <t>",
|
|
154
|
+
],
|
|
155
|
+
learnMore: [
|
|
156
|
+
"Find --client-id in DevTools: /oauth2/auth?client_id=<id>",
|
|
157
|
+
"Get --refresh-token from callback page after browser login or `auth export`",
|
|
158
|
+
],
|
|
159
|
+
}));
|
|
70
160
|
return 0;
|
|
71
161
|
}
|
|
72
162
|
const url = rest[0];
|
|
@@ -490,11 +580,15 @@ function resolvePlatformArg(args) {
|
|
|
490
580
|
}
|
|
491
581
|
function runAuthUsersCommand(args) {
|
|
492
582
|
if (args[0] === "--help" || args[0] === "-h") {
|
|
493
|
-
console.log(
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
583
|
+
console.log(renderHelp({
|
|
584
|
+
tagline: "List all user profiles stored for a platform. Each line shows: userId (username) where username is decoded from the id_token. You can use either userId or username with --user in switch/logout/delete.",
|
|
585
|
+
usage: "kweaver auth users [platform-url|alias]",
|
|
586
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
587
|
+
examples: [
|
|
588
|
+
"kweaver auth users",
|
|
589
|
+
"kweaver auth users my-platform",
|
|
590
|
+
],
|
|
591
|
+
}));
|
|
498
592
|
return 0;
|
|
499
593
|
}
|
|
500
594
|
const platform = resolvePlatformArg(args);
|
|
@@ -518,10 +612,19 @@ You can use either userId or username with --user in switch/logout/delete.`);
|
|
|
518
612
|
}
|
|
519
613
|
function runAuthSwitchCommand(args) {
|
|
520
614
|
if (args[0] === "--help" || args[0] === "-h") {
|
|
521
|
-
console.log(
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
615
|
+
console.log(renderHelp({
|
|
616
|
+
tagline: "Switch the active user for a platform. You can specify either the userId (sub claim) or the username (preferred_username from id_token).",
|
|
617
|
+
usage: "kweaver auth switch [--global] [platform-url|alias] --user <userId|username>",
|
|
618
|
+
flags: [
|
|
619
|
+
{ name: "--global", desc: "Apply switch to the global profile" },
|
|
620
|
+
{ name: "--user <userId|username>", desc: "Target user (userId or username)" },
|
|
621
|
+
],
|
|
622
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
623
|
+
examples: [
|
|
624
|
+
"kweaver auth switch --user alice",
|
|
625
|
+
"kweaver auth switch --global my-platform --user alice",
|
|
626
|
+
],
|
|
627
|
+
}));
|
|
525
628
|
return 0;
|
|
526
629
|
}
|
|
527
630
|
const { args: switchArgs, isGlobal } = consumeGlobalFlag(args);
|
|
@@ -568,14 +671,18 @@ You can specify either the userId (sub claim) or the username (preferred_usernam
|
|
|
568
671
|
}
|
|
569
672
|
async function runAuthWhoamiCommand(args) {
|
|
570
673
|
if (args[0] === "--help" || args[0] === "-h") {
|
|
571
|
-
console.log(
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
674
|
+
console.log(renderHelp({
|
|
675
|
+
tagline: "Show current user identity. For env-token mode (KWEAVER_TOKEN), the bound identity is resolved live from EACP /api/eacp/v1/user/get; for saved sessions it is decoded from the local id_token.",
|
|
676
|
+
usage: "kweaver auth whoami [platform-url|alias] [--json]",
|
|
677
|
+
flags: [
|
|
678
|
+
{ name: "--json", desc: "Output as JSON (machine-readable)" },
|
|
679
|
+
],
|
|
680
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
681
|
+
examples: [
|
|
682
|
+
"kweaver auth whoami",
|
|
683
|
+
"kweaver auth whoami my-platform --json",
|
|
684
|
+
],
|
|
685
|
+
}));
|
|
579
686
|
return 0;
|
|
580
687
|
}
|
|
581
688
|
const jsonOutput = args.includes("--json");
|
|
@@ -688,13 +795,18 @@ Options:
|
|
|
688
795
|
}
|
|
689
796
|
async function runAuthExportCommand(args) {
|
|
690
797
|
if (args[0] === "--help" || args[0] === "-h") {
|
|
691
|
-
console.log(
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
798
|
+
console.log(renderHelp({
|
|
799
|
+
tagline: "Export OAuth2 credentials for copying to a headless host (no browser there). Prints clientId, clientSecret, refreshToken, and a command to run on that machine.",
|
|
800
|
+
usage: "kweaver auth export [platform-url|alias] [--json]",
|
|
801
|
+
flags: [
|
|
802
|
+
{ name: "--json", desc: "Output as JSON (machine-readable)" },
|
|
803
|
+
],
|
|
804
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
805
|
+
examples: [
|
|
806
|
+
"kweaver auth export",
|
|
807
|
+
"kweaver auth export my-platform --json",
|
|
808
|
+
],
|
|
809
|
+
}));
|
|
698
810
|
return 0;
|
|
699
811
|
}
|
|
700
812
|
const jsonOutput = args.includes("--json");
|
|
@@ -832,20 +944,21 @@ async function loginWithInitialPasswordRecovery(normalizedTarget, signinOpts, re
|
|
|
832
944
|
}
|
|
833
945
|
async function runAuthChangePasswordCommand(args) {
|
|
834
946
|
if (args[0] === "--help" || args[0] === "-h") {
|
|
835
|
-
console.log(
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
947
|
+
console.log(renderHelp({
|
|
948
|
+
tagline: "Change the EACP account password via POST /api/eacp/v1/auth1/modifypassword. No saved OAuth token is required. Platform URL is optional; defaults to the current active platform (kweaver auth use).",
|
|
949
|
+
usage: "kweaver auth change-password [<platform-url>] [options]",
|
|
950
|
+
flags: [
|
|
951
|
+
{ name: "-u, --account <name>", desc: "Account / login name. On TTY, defaults to the current active user after a confirmation prompt. Required in non-interactive mode." },
|
|
952
|
+
{ name: "-o, --old-password <pwd>", desc: "Current password (omit on TTY to be prompted)" },
|
|
953
|
+
{ name: "-n, --new-password <pwd>", desc: "New password, 6-100 characters (omit on TTY to be prompted)" },
|
|
954
|
+
{ name: "--insecure, -k", desc: "Skip TLS certificate verification (defaults to the platform's saved preference set at login with -k; pass to override per-call)" },
|
|
955
|
+
],
|
|
956
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
957
|
+
examples: [
|
|
958
|
+
"kweaver auth change-password",
|
|
959
|
+
"kweaver auth change-password https://example.com -u alice -o old -n new",
|
|
960
|
+
],
|
|
961
|
+
}));
|
|
849
962
|
return 0;
|
|
850
963
|
}
|
|
851
964
|
const KNOWN_CP_FLAGS = new Set([
|
|
@@ -4,28 +4,49 @@ import { metricQueryData, metricDryRun } from "../api/ontology-query-metrics.js"
|
|
|
4
4
|
import { formatCallOutput } from "./call.js";
|
|
5
5
|
import { resolveBusinessDomain } from "../config/store.js";
|
|
6
6
|
import { parseJsonObject, parseSearchAfterArray, confirmYes } from "./bkn-utils.js";
|
|
7
|
+
import { renderHelp } from "../help/format.js";
|
|
7
8
|
function parseCommaSeparatedIds(raw) {
|
|
8
9
|
return raw
|
|
9
10
|
.split(",")
|
|
10
11
|
.map((s) => s.trim())
|
|
11
12
|
.filter((s) => s.length > 0);
|
|
12
13
|
}
|
|
13
|
-
const METRIC_HELP =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
const METRIC_HELP = renderHelp({
|
|
15
|
+
tagline: "BKN metrics — definitions (bkn-backend) + query (ontology-query)",
|
|
16
|
+
usage: "kweaver bkn metric <action> <kn-id> [args] [flags]",
|
|
17
|
+
sections: [
|
|
18
|
+
{
|
|
19
|
+
title: "MANAGEMENT (bkn-backend)",
|
|
20
|
+
items: [
|
|
21
|
+
{ name: "list", desc: "List metrics (--limit / --branch / --name-pattern / --sort / --direction / --offset / --tag / --group-id)" },
|
|
22
|
+
{ name: "get", desc: "Get metric(s) by id — comma-separated for multiple" },
|
|
23
|
+
{ name: "create", desc: "Create metric from JSON (--branch / --strict-mode)" },
|
|
24
|
+
{ name: "search", desc: "Search metrics (--branch / --strict-mode / --limit / --search-after)" },
|
|
25
|
+
{ name: "validate", desc: "Validate metric JSON (--branch / --strict-mode / --import-mode)" },
|
|
26
|
+
{ name: "update", desc: "Update metric by id (--branch / --strict-mode)" },
|
|
27
|
+
{ name: "delete", desc: "Delete metric(s) — comma-separated for multiple (-y to skip confirm)" },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
title: "QUERY (ontology-query)",
|
|
32
|
+
items: [
|
|
33
|
+
{ name: "query", desc: "Query metric data (--branch / --fill-null)" },
|
|
34
|
+
{ name: "dry-run", desc: "Dry-run a metric JSON (--branch / --fill-null)" },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
flags: [
|
|
39
|
+
{ name: "-bd, --biz-domain <s>", desc: "Business domain (default: bd_public)" },
|
|
40
|
+
{ name: "--pretty / --compact", desc: "JSON output style (default: pretty)" },
|
|
41
|
+
],
|
|
42
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
43
|
+
examples: [
|
|
44
|
+
"kweaver bkn metric list kn-123",
|
|
45
|
+
"kweaver bkn metric query kn-123 metric-456 '{\"limit\":10}'",
|
|
46
|
+
"kweaver bkn metric dry-run kn-123 '{\"formula\":\"...\"}'",
|
|
47
|
+
],
|
|
48
|
+
learnMore: ["list: default --limit 30. search/query JSON: default body limit 50 when unset."],
|
|
49
|
+
});
|
|
29
50
|
function parseListArgs(args) {
|
|
30
51
|
let pretty = true;
|
|
31
52
|
let businessDomain = "";
|