@alva-ai/toolkit 0.18.0 → 0.20.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 +4 -1
- package/dist/browser.global.js +2 -2
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +37 -3
- package/dist/cli.js +913 -274
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +29 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -2
- package/dist/index.d.ts +28 -2
- package/dist/index.js +29 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9498,10 +9498,10 @@ var AlvaError = class extends Error {
|
|
|
9498
9498
|
};
|
|
9499
9499
|
var CliUsageError = class extends Error {
|
|
9500
9500
|
command;
|
|
9501
|
-
constructor(message,
|
|
9501
|
+
constructor(message, command2) {
|
|
9502
9502
|
super(message);
|
|
9503
9503
|
this.name = "CliUsageError";
|
|
9504
|
-
this.command =
|
|
9504
|
+
this.command = command2;
|
|
9505
9505
|
}
|
|
9506
9506
|
};
|
|
9507
9507
|
|
|
@@ -9707,6 +9707,7 @@ var DeployResource = class {
|
|
|
9707
9707
|
args: params.args,
|
|
9708
9708
|
push_notify: params.push_notify,
|
|
9709
9709
|
max_heap_size_mb: params.max_heap_size_mb,
|
|
9710
|
+
execution_timeout_seconds: params.execution_timeout_seconds,
|
|
9710
9711
|
run_as_user_id: params.run_as_user_id,
|
|
9711
9712
|
start_at: params.start_at,
|
|
9712
9713
|
end_at: params.end_at,
|
|
@@ -9754,6 +9755,8 @@ var DeployResource = class {
|
|
|
9754
9755
|
}
|
|
9755
9756
|
/**
|
|
9756
9757
|
* Fire the cronjob workflow once, immediately, bypassing the schedule.
|
|
9758
|
+
* This is not a dry run: when publisher push and subscriber alert bindings
|
|
9759
|
+
* are enabled, a successful Feed execution may send real notifications.
|
|
9757
9760
|
* Async — returns the Hatchet workflow run id at enqueue. The
|
|
9758
9761
|
* `cronjob_runs` row can appear as DISPATCHED/RUNNING before it reaches a
|
|
9759
9762
|
* terminal status; callers verify completion by polling
|
|
@@ -10971,40 +10974,40 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
10971
10974
|
file: "contracts",
|
|
10972
10975
|
method: "GET",
|
|
10973
10976
|
path: "/api/v1/options/contracts",
|
|
10974
|
-
tier: "
|
|
10975
|
-
required_subscription_tier: "
|
|
10976
|
-
access: "
|
|
10977
|
-
pro_required:
|
|
10977
|
+
tier: "public",
|
|
10978
|
+
required_subscription_tier: "free",
|
|
10979
|
+
access: "free_and_pro",
|
|
10980
|
+
pro_required: false
|
|
10978
10981
|
},
|
|
10979
10982
|
{
|
|
10980
10983
|
skill: "arrays-data-api-options",
|
|
10981
10984
|
file: "kline",
|
|
10982
10985
|
method: "GET",
|
|
10983
10986
|
path: "/api/v1/options/kline",
|
|
10984
|
-
tier: "
|
|
10985
|
-
required_subscription_tier: "
|
|
10986
|
-
access: "
|
|
10987
|
-
pro_required:
|
|
10987
|
+
tier: "public",
|
|
10988
|
+
required_subscription_tier: "free",
|
|
10989
|
+
access: "free_and_pro",
|
|
10990
|
+
pro_required: false
|
|
10988
10991
|
},
|
|
10989
10992
|
{
|
|
10990
10993
|
skill: "arrays-data-api-options",
|
|
10991
10994
|
file: "greeks",
|
|
10992
10995
|
method: "GET",
|
|
10993
10996
|
path: "/api/v1/options/greeks",
|
|
10994
|
-
tier: "
|
|
10995
|
-
required_subscription_tier: "
|
|
10996
|
-
access: "
|
|
10997
|
-
pro_required:
|
|
10997
|
+
tier: "public",
|
|
10998
|
+
required_subscription_tier: "free",
|
|
10999
|
+
access: "free_and_pro",
|
|
11000
|
+
pro_required: false
|
|
10998
11001
|
},
|
|
10999
11002
|
{
|
|
11000
11003
|
skill: "arrays-data-api-options",
|
|
11001
11004
|
file: "chain",
|
|
11002
11005
|
method: "GET",
|
|
11003
11006
|
path: "/api/v1/options/chain",
|
|
11004
|
-
tier: "
|
|
11005
|
-
required_subscription_tier: "
|
|
11006
|
-
access: "
|
|
11007
|
-
pro_required:
|
|
11007
|
+
tier: "public",
|
|
11008
|
+
required_subscription_tier: "free",
|
|
11009
|
+
access: "free_and_pro",
|
|
11010
|
+
pro_required: false
|
|
11008
11011
|
},
|
|
11009
11012
|
{
|
|
11010
11013
|
skill: "arrays-data-api-equity-fundamentals",
|
|
@@ -11921,7 +11924,15 @@ var SubscriptionsResource = class {
|
|
|
11921
11924
|
async subscribeFeed(params) {
|
|
11922
11925
|
this.client._requireAuth();
|
|
11923
11926
|
const path = `/api/v1/subscriptions/feed/${encodeURIComponent(params.username)}/${encodeURIComponent(params.name)}`;
|
|
11924
|
-
|
|
11927
|
+
if (params.channelId === void 0) {
|
|
11928
|
+
return this.client._request(
|
|
11929
|
+
"POST",
|
|
11930
|
+
path
|
|
11931
|
+
);
|
|
11932
|
+
}
|
|
11933
|
+
return this.client._request("POST", path, {
|
|
11934
|
+
body: { channel_id: params.channelId }
|
|
11935
|
+
});
|
|
11925
11936
|
}
|
|
11926
11937
|
/**
|
|
11927
11938
|
* Unsubscribe from one feed `(username, name)` — disable that automation's
|
|
@@ -12895,6 +12906,634 @@ import * as os from "os";
|
|
|
12895
12906
|
import * as fsPromises from "fs/promises";
|
|
12896
12907
|
import * as readline from "readline";
|
|
12897
12908
|
|
|
12909
|
+
// src/cli/commandDefinitions.ts
|
|
12910
|
+
function command(path, {
|
|
12911
|
+
values = [],
|
|
12912
|
+
booleans = [],
|
|
12913
|
+
positionals = [],
|
|
12914
|
+
optionalPositionals = 0,
|
|
12915
|
+
passthrough = false
|
|
12916
|
+
} = {}) {
|
|
12917
|
+
const flags = {};
|
|
12918
|
+
for (const name of values) {
|
|
12919
|
+
flags[name] = "value";
|
|
12920
|
+
}
|
|
12921
|
+
for (const name of booleans) {
|
|
12922
|
+
if (flags[name] !== void 0) {
|
|
12923
|
+
throw new Error(`CLI flag --${name} has conflicting definitions`);
|
|
12924
|
+
}
|
|
12925
|
+
flags[name] = "boolean";
|
|
12926
|
+
}
|
|
12927
|
+
return {
|
|
12928
|
+
path: path.split(" "),
|
|
12929
|
+
flags,
|
|
12930
|
+
positionals: {
|
|
12931
|
+
names: positionals,
|
|
12932
|
+
min: positionals.length - optionalPositionals,
|
|
12933
|
+
max: positionals.length
|
|
12934
|
+
},
|
|
12935
|
+
passthrough
|
|
12936
|
+
};
|
|
12937
|
+
}
|
|
12938
|
+
var GLOBAL_FLAG_DEFINITIONS = {
|
|
12939
|
+
"api-key": "value",
|
|
12940
|
+
"base-url": "value",
|
|
12941
|
+
profile: "value",
|
|
12942
|
+
"arrays-endpoint": "value",
|
|
12943
|
+
help: "boolean"
|
|
12944
|
+
};
|
|
12945
|
+
var COMMAND_DEFINITIONS = [
|
|
12946
|
+
command("configure", {
|
|
12947
|
+
values: ["api-key", "base-url", "profile"]
|
|
12948
|
+
}),
|
|
12949
|
+
// Some route-map nodes are also valid help targets. Their handlers preserve
|
|
12950
|
+
// the existing bare-command help behavior while the trie still resolves
|
|
12951
|
+
// deeper leaves.
|
|
12952
|
+
command("auth"),
|
|
12953
|
+
command("auth login", {
|
|
12954
|
+
values: ["profile", "auth-url", "base-url"],
|
|
12955
|
+
booleans: ["browser", "no-browser"]
|
|
12956
|
+
}),
|
|
12957
|
+
command("whoami"),
|
|
12958
|
+
command("user me"),
|
|
12959
|
+
command("fs read", { values: ["path", "offset", "size"] }),
|
|
12960
|
+
command("fs write", {
|
|
12961
|
+
values: ["path", "data", "file"],
|
|
12962
|
+
booleans: ["mkdir-parents", "append"]
|
|
12963
|
+
}),
|
|
12964
|
+
command("fs stat", { values: ["path"] }),
|
|
12965
|
+
command("fs readdir", {
|
|
12966
|
+
values: ["path"],
|
|
12967
|
+
booleans: ["recursive"]
|
|
12968
|
+
}),
|
|
12969
|
+
command("fs mkdir", { values: ["path"] }),
|
|
12970
|
+
command("fs remove", {
|
|
12971
|
+
values: ["path"],
|
|
12972
|
+
booleans: ["recursive"]
|
|
12973
|
+
}),
|
|
12974
|
+
command("fs rename", { values: ["old-path", "new-path"] }),
|
|
12975
|
+
command("fs copy", { values: ["src-path", "dst-path"] }),
|
|
12976
|
+
command("fs symlink", { values: ["target-path", "link-path"] }),
|
|
12977
|
+
command("fs readlink", { values: ["path"] }),
|
|
12978
|
+
command("fs chmod", { values: ["path", "mode"] }),
|
|
12979
|
+
command("fs grant", { values: ["path", "subject", "permission"] }),
|
|
12980
|
+
command("fs revoke", { values: ["path", "subject", "permission"] }),
|
|
12981
|
+
command("run", {
|
|
12982
|
+
values: [
|
|
12983
|
+
"code",
|
|
12984
|
+
"local-file",
|
|
12985
|
+
"entry-path",
|
|
12986
|
+
"working-dir",
|
|
12987
|
+
"args",
|
|
12988
|
+
"max-heap-size-mb",
|
|
12989
|
+
"timeout-ms"
|
|
12990
|
+
]
|
|
12991
|
+
}),
|
|
12992
|
+
command("deploy create", {
|
|
12993
|
+
values: [
|
|
12994
|
+
"name",
|
|
12995
|
+
"path",
|
|
12996
|
+
"cron",
|
|
12997
|
+
"args",
|
|
12998
|
+
"max-heap-size-mb",
|
|
12999
|
+
"execution-timeout-seconds",
|
|
13000
|
+
"run-as-service-account"
|
|
13001
|
+
],
|
|
13002
|
+
booleans: ["push-notify"]
|
|
13003
|
+
}),
|
|
13004
|
+
command("deploy list", { values: ["limit", "cursor"] }),
|
|
13005
|
+
command("deploy get", { values: ["id"] }),
|
|
13006
|
+
command("deploy update", {
|
|
13007
|
+
values: [
|
|
13008
|
+
"id",
|
|
13009
|
+
"name",
|
|
13010
|
+
"cron",
|
|
13011
|
+
"args",
|
|
13012
|
+
"max-heap-size-mb",
|
|
13013
|
+
"execution-timeout-seconds",
|
|
13014
|
+
"run-as-service-account"
|
|
13015
|
+
],
|
|
13016
|
+
booleans: ["push-notify", "clear-run-as"]
|
|
13017
|
+
}),
|
|
13018
|
+
command("deploy delete", { values: ["id"] }),
|
|
13019
|
+
command("deploy pause", { values: ["id"] }),
|
|
13020
|
+
command("deploy resume", { values: ["id"] }),
|
|
13021
|
+
command("deploy trigger", { values: ["id"] }),
|
|
13022
|
+
command("deploy runs", { values: ["id", "first", "cursor"] }),
|
|
13023
|
+
command("deploy run-status", {
|
|
13024
|
+
values: ["id", "workflow-run-id"]
|
|
13025
|
+
}),
|
|
13026
|
+
command("deploy run-logs", { values: ["id", "run-id"] }),
|
|
13027
|
+
command("loop create", {
|
|
13028
|
+
values: [
|
|
13029
|
+
"goal",
|
|
13030
|
+
"cron",
|
|
13031
|
+
"channel-id",
|
|
13032
|
+
"start",
|
|
13033
|
+
"until",
|
|
13034
|
+
"runs",
|
|
13035
|
+
"name",
|
|
13036
|
+
// Retained so the handler can emit the existing migration guidance.
|
|
13037
|
+
"expires-in"
|
|
13038
|
+
]
|
|
13039
|
+
}),
|
|
13040
|
+
command("service-account create", { values: ["name"] }),
|
|
13041
|
+
command("service-account list"),
|
|
13042
|
+
command("service-account delete", { values: ["id"] }),
|
|
13043
|
+
command("service-account grant", {
|
|
13044
|
+
values: ["id", "path", "permission"]
|
|
13045
|
+
}),
|
|
13046
|
+
command("service-account revoke", {
|
|
13047
|
+
values: ["id", "path", "permission"]
|
|
13048
|
+
}),
|
|
13049
|
+
command("feed list", { values: ["limit", "cursor", "status"] }),
|
|
13050
|
+
command("feed stop", { values: ["id"] }),
|
|
13051
|
+
command("feed resume", { values: ["id"] }),
|
|
13052
|
+
command("feed delete", { values: ["id"] }),
|
|
13053
|
+
command("feed set-visibility", { values: ["id", "visibility"] }),
|
|
13054
|
+
command("automation list", {
|
|
13055
|
+
values: ["limit", "cursor", "status"],
|
|
13056
|
+
booleans: ["json"]
|
|
13057
|
+
}),
|
|
13058
|
+
command("automation inspect", {
|
|
13059
|
+
values: ["id"],
|
|
13060
|
+
booleans: ["json"]
|
|
13061
|
+
}),
|
|
13062
|
+
command("automation publish", {
|
|
13063
|
+
values: [
|
|
13064
|
+
"name",
|
|
13065
|
+
"version",
|
|
13066
|
+
"cronjob-id",
|
|
13067
|
+
"view-json",
|
|
13068
|
+
"description",
|
|
13069
|
+
"changelog",
|
|
13070
|
+
"agent-type"
|
|
13071
|
+
]
|
|
13072
|
+
}),
|
|
13073
|
+
command("automation stop", { values: ["id"] }),
|
|
13074
|
+
command("automation resume", { values: ["id"] }),
|
|
13075
|
+
command("automation delete", { values: ["id"] }),
|
|
13076
|
+
command("credits wallet"),
|
|
13077
|
+
command("credits items", {
|
|
13078
|
+
values: ["last", "start", "end", "session-id", "first", "after"],
|
|
13079
|
+
booleans: ["today"]
|
|
13080
|
+
}),
|
|
13081
|
+
command("playbooks trending", {
|
|
13082
|
+
values: ["keyword", "tags", "tag", "sort", "limit", "cursor", "current"],
|
|
13083
|
+
booleans: ["json"]
|
|
13084
|
+
}),
|
|
13085
|
+
command("playbooks set-visibility", {
|
|
13086
|
+
values: ["name", "visibility"]
|
|
13087
|
+
}),
|
|
13088
|
+
command("playbooks get", {
|
|
13089
|
+
values: ["ids", "id", "ref"],
|
|
13090
|
+
booleans: ["json"]
|
|
13091
|
+
}),
|
|
13092
|
+
command("playbooks list", {
|
|
13093
|
+
values: ["owner", "limit", "cursor"],
|
|
13094
|
+
booleans: ["json"]
|
|
13095
|
+
}),
|
|
13096
|
+
command("functions allowance"),
|
|
13097
|
+
command("functions allowance get", { values: ["playbook-id"] }),
|
|
13098
|
+
command("functions allowance list"),
|
|
13099
|
+
command("functions allowance create", {
|
|
13100
|
+
values: ["playbook-id", "amount"]
|
|
13101
|
+
}),
|
|
13102
|
+
command("functions allowance revoke", { values: ["playbook-id"] }),
|
|
13103
|
+
command("functions register", {
|
|
13104
|
+
values: [
|
|
13105
|
+
"playbook-id",
|
|
13106
|
+
"function-name",
|
|
13107
|
+
"entry-script-path",
|
|
13108
|
+
"params-schema",
|
|
13109
|
+
"params-schema-file",
|
|
13110
|
+
"run-as-service-account"
|
|
13111
|
+
],
|
|
13112
|
+
booleans: ["allow-charges", "clear-run-as"]
|
|
13113
|
+
}),
|
|
13114
|
+
command("functions list", { values: ["playbook-id"] }),
|
|
13115
|
+
command("functions delete", {
|
|
13116
|
+
values: ["playbook-id", "function-name"]
|
|
13117
|
+
}),
|
|
13118
|
+
command("functions invoke", {
|
|
13119
|
+
values: ["playbook-id", "function-name", "params"]
|
|
13120
|
+
}),
|
|
13121
|
+
command("release feed", {
|
|
13122
|
+
values: [
|
|
13123
|
+
"name",
|
|
13124
|
+
"version",
|
|
13125
|
+
"cronjob-id",
|
|
13126
|
+
"view-json",
|
|
13127
|
+
"description",
|
|
13128
|
+
"changelog",
|
|
13129
|
+
"agent-type"
|
|
13130
|
+
]
|
|
13131
|
+
}),
|
|
13132
|
+
command("release playbook-draft", {
|
|
13133
|
+
values: [
|
|
13134
|
+
"name",
|
|
13135
|
+
"display-name",
|
|
13136
|
+
"description",
|
|
13137
|
+
"feeds",
|
|
13138
|
+
"trading-symbols",
|
|
13139
|
+
"skill-id",
|
|
13140
|
+
"tags"
|
|
13141
|
+
]
|
|
13142
|
+
}),
|
|
13143
|
+
command("release playbook", {
|
|
13144
|
+
values: ["name", "version", "feeds", "changelog", "readme-url"],
|
|
13145
|
+
booleans: ["bypass-lint"]
|
|
13146
|
+
}),
|
|
13147
|
+
command("lint playbook", {
|
|
13148
|
+
values: ["format"],
|
|
13149
|
+
positionals: ["file argument"]
|
|
13150
|
+
}),
|
|
13151
|
+
command("secrets create", { values: ["name", "value"] }),
|
|
13152
|
+
command("secrets list"),
|
|
13153
|
+
command("secrets get", { values: ["name"] }),
|
|
13154
|
+
command("secrets update", { values: ["name", "value"] }),
|
|
13155
|
+
command("secrets delete", { values: ["name"] }),
|
|
13156
|
+
command("sdk doc", { values: ["name"] }),
|
|
13157
|
+
command("sdk partitions"),
|
|
13158
|
+
command("sdk partition-summary", { values: ["partition"] }),
|
|
13159
|
+
command("data-skills list", { booleans: ["json"] }),
|
|
13160
|
+
command("data-skills summary", {
|
|
13161
|
+
booleans: ["json"],
|
|
13162
|
+
positionals: ["skill name"]
|
|
13163
|
+
}),
|
|
13164
|
+
command("data-skills endpoint", {
|
|
13165
|
+
booleans: ["json"],
|
|
13166
|
+
positionals: ["skill name", "endpoint file"]
|
|
13167
|
+
}),
|
|
13168
|
+
command("skillhub list", {
|
|
13169
|
+
values: ["tag", "username"],
|
|
13170
|
+
booleans: ["json"]
|
|
13171
|
+
}),
|
|
13172
|
+
command("skillhub tags", { booleans: ["json"] }),
|
|
13173
|
+
command("skillhub get", {
|
|
13174
|
+
booleans: ["json"],
|
|
13175
|
+
positionals: ["playbook skill identifier"]
|
|
13176
|
+
}),
|
|
13177
|
+
command("skillhub file", {
|
|
13178
|
+
booleans: ["json"],
|
|
13179
|
+
positionals: ["playbook skill identifier", "file path"]
|
|
13180
|
+
}),
|
|
13181
|
+
command("comments create", {
|
|
13182
|
+
values: ["username", "name", "content", "parent-id"]
|
|
13183
|
+
}),
|
|
13184
|
+
command("comments pin", { values: ["comment-id"] }),
|
|
13185
|
+
command("comments unpin", { values: ["comment-id"] }),
|
|
13186
|
+
command("notification-history list-feed", {
|
|
13187
|
+
values: [
|
|
13188
|
+
"username",
|
|
13189
|
+
"name",
|
|
13190
|
+
"delivery-provider",
|
|
13191
|
+
// Retained so the handler can emit the existing rename guidance.
|
|
13192
|
+
"channel",
|
|
13193
|
+
"status",
|
|
13194
|
+
"since",
|
|
13195
|
+
"first",
|
|
13196
|
+
"cursor"
|
|
13197
|
+
]
|
|
13198
|
+
}),
|
|
13199
|
+
command("notification-preferences list"),
|
|
13200
|
+
command("notification-preferences enable-session-completed"),
|
|
13201
|
+
command("notification-preferences disable-session-completed"),
|
|
13202
|
+
command("feedback submit", {
|
|
13203
|
+
values: [
|
|
13204
|
+
"source",
|
|
13205
|
+
"category",
|
|
13206
|
+
"severity",
|
|
13207
|
+
"summary",
|
|
13208
|
+
"details",
|
|
13209
|
+
"evidence-json",
|
|
13210
|
+
"context-json",
|
|
13211
|
+
// Retained so the handler can emit the existing migration guidance.
|
|
13212
|
+
"dedupe-key"
|
|
13213
|
+
]
|
|
13214
|
+
}),
|
|
13215
|
+
command("subscriptions follow-playbook", {
|
|
13216
|
+
values: ["username", "name"]
|
|
13217
|
+
}),
|
|
13218
|
+
command("subscriptions unfollow-playbook", {
|
|
13219
|
+
values: ["username", "name"]
|
|
13220
|
+
}),
|
|
13221
|
+
command("subscriptions subscribe-feed", {
|
|
13222
|
+
values: ["username", "name"]
|
|
13223
|
+
}),
|
|
13224
|
+
command("subscriptions unsubscribe-feed", {
|
|
13225
|
+
values: ["username", "name"]
|
|
13226
|
+
}),
|
|
13227
|
+
command("subscriptions list", { values: ["first", "cursor"] }),
|
|
13228
|
+
command("subscriptions follows", { values: ["limit", "cursor"] }),
|
|
13229
|
+
command("subscriptions subscribe", {
|
|
13230
|
+
values: ["feed-ids", "channel-id", "playbook-ids"]
|
|
13231
|
+
}),
|
|
13232
|
+
command("subscriptions unsubscribe", {
|
|
13233
|
+
values: ["feed-ids", "playbook-ids"]
|
|
13234
|
+
}),
|
|
13235
|
+
command("alert list", {
|
|
13236
|
+
values: ["first", "cursor"],
|
|
13237
|
+
booleans: ["json"]
|
|
13238
|
+
}),
|
|
13239
|
+
command("alert follows", { values: ["limit", "cursor"] }),
|
|
13240
|
+
command("alert enable", {
|
|
13241
|
+
values: [
|
|
13242
|
+
"automation",
|
|
13243
|
+
"automation-ids",
|
|
13244
|
+
"channel-id",
|
|
13245
|
+
"playbook",
|
|
13246
|
+
"playbook-ids"
|
|
13247
|
+
]
|
|
13248
|
+
}),
|
|
13249
|
+
command("alert disable", {
|
|
13250
|
+
values: ["automation", "automation-ids", "playbook", "playbook-ids"]
|
|
13251
|
+
}),
|
|
13252
|
+
command("alert group"),
|
|
13253
|
+
command("alert group list", {
|
|
13254
|
+
values: ["session-id"],
|
|
13255
|
+
booleans: ["json"]
|
|
13256
|
+
}),
|
|
13257
|
+
command("alert group enable", {
|
|
13258
|
+
values: ["automation", "automation-ids", "channel-id", "session-id"]
|
|
13259
|
+
}),
|
|
13260
|
+
command("alert group disable", {
|
|
13261
|
+
values: ["automation", "automation-ids", "channel-id", "session-id"]
|
|
13262
|
+
}),
|
|
13263
|
+
command("alert history", {
|
|
13264
|
+
values: [
|
|
13265
|
+
"automation",
|
|
13266
|
+
"playbook",
|
|
13267
|
+
"playbook-ids",
|
|
13268
|
+
"delivery-provider",
|
|
13269
|
+
// Retained so the handler can emit the existing rename guidance.
|
|
13270
|
+
"channel",
|
|
13271
|
+
"status",
|
|
13272
|
+
"since",
|
|
13273
|
+
"first",
|
|
13274
|
+
"cursor"
|
|
13275
|
+
]
|
|
13276
|
+
}),
|
|
13277
|
+
command("alert preferences"),
|
|
13278
|
+
command("alert enable-session-completed"),
|
|
13279
|
+
command("alert disable-session-completed"),
|
|
13280
|
+
command("remix", {
|
|
13281
|
+
values: ["child-username", "child-name", "parents"]
|
|
13282
|
+
}),
|
|
13283
|
+
command("arrays"),
|
|
13284
|
+
command("arrays token"),
|
|
13285
|
+
command("arrays token ensure"),
|
|
13286
|
+
command("arrays token status"),
|
|
13287
|
+
command("screenshot", {
|
|
13288
|
+
values: [
|
|
13289
|
+
"url",
|
|
13290
|
+
"out",
|
|
13291
|
+
"selector",
|
|
13292
|
+
"xpath",
|
|
13293
|
+
"compress-quality",
|
|
13294
|
+
"compress-max-width"
|
|
13295
|
+
],
|
|
13296
|
+
booleans: ["base64", "full", "compress"]
|
|
13297
|
+
}),
|
|
13298
|
+
command("portfolio accounts"),
|
|
13299
|
+
command("portfolio summary", { values: ["account-id"] }),
|
|
13300
|
+
command("portfolio activities", {
|
|
13301
|
+
values: ["account-id", "limit", "page-token"]
|
|
13302
|
+
}),
|
|
13303
|
+
command("trading accounts"),
|
|
13304
|
+
command("trading portfolio", { values: ["account-id"] }),
|
|
13305
|
+
command("trading orders", {
|
|
13306
|
+
values: ["account-id", "source", "since", "limit"]
|
|
13307
|
+
}),
|
|
13308
|
+
command("trading subscriptions", { values: ["account-id"] }),
|
|
13309
|
+
command("trading equity-history", {
|
|
13310
|
+
values: ["account-id", "timeframe", "since-ms", "until-ms"]
|
|
13311
|
+
}),
|
|
13312
|
+
command("trading risk-rules"),
|
|
13313
|
+
command("trading subscribe", {
|
|
13314
|
+
values: [
|
|
13315
|
+
"account-id",
|
|
13316
|
+
"source-username",
|
|
13317
|
+
"source-feed",
|
|
13318
|
+
"playbook-id",
|
|
13319
|
+
"playbook-version"
|
|
13320
|
+
],
|
|
13321
|
+
booleans: ["execute-latest"]
|
|
13322
|
+
}),
|
|
13323
|
+
command("trading unsubscribe", { values: ["subscription-id"] }),
|
|
13324
|
+
command("trading execute", {
|
|
13325
|
+
values: ["account-id", "signal", "source-username", "source-feed"],
|
|
13326
|
+
booleans: ["dry-run"]
|
|
13327
|
+
}),
|
|
13328
|
+
command("trading update-risk-rules", {
|
|
13329
|
+
values: [
|
|
13330
|
+
"max-single-order-value",
|
|
13331
|
+
"max-single-order-enabled",
|
|
13332
|
+
"max-daily-turnover-value",
|
|
13333
|
+
"max-daily-turnover-enabled",
|
|
13334
|
+
"max-daily-orders-value",
|
|
13335
|
+
"max-daily-orders-enabled"
|
|
13336
|
+
]
|
|
13337
|
+
}),
|
|
13338
|
+
command("broker", { passthrough: true })
|
|
13339
|
+
];
|
|
13340
|
+
|
|
13341
|
+
// src/cli/commandSchema.ts
|
|
13342
|
+
function buildCommandTree(definitions) {
|
|
13343
|
+
const root = { children: /* @__PURE__ */ new Map() };
|
|
13344
|
+
for (const definition of definitions) {
|
|
13345
|
+
if (definition.path.length === 0) {
|
|
13346
|
+
throw new Error("CLI command path cannot be empty");
|
|
13347
|
+
}
|
|
13348
|
+
if (definition.positionals.min < 0 || definition.positionals.max < definition.positionals.min || definition.positionals.max !== definition.positionals.names.length) {
|
|
13349
|
+
throw new Error(
|
|
13350
|
+
`Invalid positional definition for '${definition.path.join(" ")}'`
|
|
13351
|
+
);
|
|
13352
|
+
}
|
|
13353
|
+
let node = root;
|
|
13354
|
+
for (const segment of definition.path) {
|
|
13355
|
+
let child = node.children.get(segment);
|
|
13356
|
+
if (child === void 0) {
|
|
13357
|
+
child = { children: /* @__PURE__ */ new Map() };
|
|
13358
|
+
node.children.set(segment, child);
|
|
13359
|
+
}
|
|
13360
|
+
node = child;
|
|
13361
|
+
}
|
|
13362
|
+
if (node.definition !== void 0) {
|
|
13363
|
+
throw new Error(
|
|
13364
|
+
`Duplicate CLI command definition '${definition.path.join(" ")}'`
|
|
13365
|
+
);
|
|
13366
|
+
}
|
|
13367
|
+
node.definition = definition;
|
|
13368
|
+
}
|
|
13369
|
+
return root;
|
|
13370
|
+
}
|
|
13371
|
+
var COMMAND_TREE = buildCommandTree(COMMAND_DEFINITIONS);
|
|
13372
|
+
function editDistance(a, b) {
|
|
13373
|
+
let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
|
|
13374
|
+
for (let row = 1; row <= a.length; row++) {
|
|
13375
|
+
const current = [row];
|
|
13376
|
+
for (let column = 1; column <= b.length; column++) {
|
|
13377
|
+
current[column] = Math.min(
|
|
13378
|
+
current[column - 1] + 1,
|
|
13379
|
+
previous[column] + 1,
|
|
13380
|
+
previous[column - 1] + (a[row - 1] === b[column - 1] ? 0 : 1)
|
|
13381
|
+
);
|
|
13382
|
+
}
|
|
13383
|
+
previous = current;
|
|
13384
|
+
}
|
|
13385
|
+
return previous[b.length];
|
|
13386
|
+
}
|
|
13387
|
+
function closestFlag(input, available) {
|
|
13388
|
+
let closest;
|
|
13389
|
+
let distance = Number.POSITIVE_INFINITY;
|
|
13390
|
+
for (const candidate of Object.keys(available)) {
|
|
13391
|
+
const candidateDistance = editDistance(input, candidate);
|
|
13392
|
+
if (candidateDistance < distance) {
|
|
13393
|
+
closest = candidate;
|
|
13394
|
+
distance = candidateDistance;
|
|
13395
|
+
}
|
|
13396
|
+
}
|
|
13397
|
+
const threshold = input.length <= 4 ? 1 : 2;
|
|
13398
|
+
return distance <= threshold ? closest : void 0;
|
|
13399
|
+
}
|
|
13400
|
+
function mergeFlags(definition) {
|
|
13401
|
+
return { ...GLOBAL_FLAG_DEFINITIONS, ...definition.flags };
|
|
13402
|
+
}
|
|
13403
|
+
function resolveCommand(args) {
|
|
13404
|
+
let node = COMMAND_TREE;
|
|
13405
|
+
let consumed = 0;
|
|
13406
|
+
while (consumed < args.length) {
|
|
13407
|
+
const input = args[consumed];
|
|
13408
|
+
if (input.startsWith("-")) break;
|
|
13409
|
+
const child = node.children.get(input);
|
|
13410
|
+
if (child !== void 0) {
|
|
13411
|
+
node = child;
|
|
13412
|
+
consumed++;
|
|
13413
|
+
continue;
|
|
13414
|
+
}
|
|
13415
|
+
if (node.definition !== void 0 && node.children.size === 0) break;
|
|
13416
|
+
if (consumed === 0) {
|
|
13417
|
+
throw new CliUsageError(`Unknown command: '${input}'`);
|
|
13418
|
+
}
|
|
13419
|
+
const group2 = args[0];
|
|
13420
|
+
const command2 = args.slice(0, consumed).join(" ");
|
|
13421
|
+
throw new CliUsageError(
|
|
13422
|
+
`Unknown subcommand: ${command2} ${input}. Use 'alva ${group2} --help' for usage.`,
|
|
13423
|
+
group2
|
|
13424
|
+
);
|
|
13425
|
+
}
|
|
13426
|
+
if (node.definition !== void 0) {
|
|
13427
|
+
return { definition: node.definition, consumed };
|
|
13428
|
+
}
|
|
13429
|
+
const group = args[0];
|
|
13430
|
+
if (group === void 0) {
|
|
13431
|
+
throw new CliUsageError("Missing command");
|
|
13432
|
+
}
|
|
13433
|
+
throw new CliUsageError(`Missing subcommand for ${group}`, group);
|
|
13434
|
+
}
|
|
13435
|
+
function unsupportedFlag(name, definition, available) {
|
|
13436
|
+
const command2 = definition.path.join(" ");
|
|
13437
|
+
const suggestion = closestFlag(name, available);
|
|
13438
|
+
const suffix = suggestion === void 0 ? "" : ` Did you mean '--${suggestion}'?`;
|
|
13439
|
+
return new CliUsageError(
|
|
13440
|
+
`--${name} is not supported for '${command2}'.${suffix}`,
|
|
13441
|
+
definition.path[0]
|
|
13442
|
+
);
|
|
13443
|
+
}
|
|
13444
|
+
function parseCommand(args) {
|
|
13445
|
+
const { definition, consumed } = resolveCommand(args);
|
|
13446
|
+
if (definition.passthrough === true) {
|
|
13447
|
+
return {
|
|
13448
|
+
path: definition.path,
|
|
13449
|
+
flags: {},
|
|
13450
|
+
positionals: [],
|
|
13451
|
+
passthrough: args.slice(consumed)
|
|
13452
|
+
};
|
|
13453
|
+
}
|
|
13454
|
+
const available = mergeFlags(definition);
|
|
13455
|
+
const flags = {};
|
|
13456
|
+
const positionals = [];
|
|
13457
|
+
for (let index = consumed; index < args.length; index++) {
|
|
13458
|
+
const input = args[index];
|
|
13459
|
+
if (input === "-h") {
|
|
13460
|
+
flags.help = "true";
|
|
13461
|
+
continue;
|
|
13462
|
+
}
|
|
13463
|
+
if (!input.startsWith("--")) {
|
|
13464
|
+
positionals.push(input);
|
|
13465
|
+
continue;
|
|
13466
|
+
}
|
|
13467
|
+
const equalsIndex = input.indexOf("=");
|
|
13468
|
+
const externalName = equalsIndex === -1 ? input.slice(2) : input.slice(2, equalsIndex);
|
|
13469
|
+
let name = externalName;
|
|
13470
|
+
let kind = available[name];
|
|
13471
|
+
let negated = false;
|
|
13472
|
+
if (kind === void 0 && name.startsWith("no-") && available[name.slice(3)] === "boolean") {
|
|
13473
|
+
name = name.slice(3);
|
|
13474
|
+
kind = "boolean";
|
|
13475
|
+
negated = true;
|
|
13476
|
+
}
|
|
13477
|
+
if (kind === void 0) {
|
|
13478
|
+
throw unsupportedFlag(externalName, definition, available);
|
|
13479
|
+
}
|
|
13480
|
+
if (equalsIndex !== -1) {
|
|
13481
|
+
const value2 = input.slice(equalsIndex + 1);
|
|
13482
|
+
if (kind === "boolean") {
|
|
13483
|
+
if (value2 !== "true" && value2 !== "false") {
|
|
13484
|
+
throw new CliUsageError(
|
|
13485
|
+
`--${externalName} must be true or false`,
|
|
13486
|
+
definition.path[0]
|
|
13487
|
+
);
|
|
13488
|
+
}
|
|
13489
|
+
flags[name] = negated === true ? value2 === "true" ? "false" : "true" : value2;
|
|
13490
|
+
} else {
|
|
13491
|
+
flags[name] = value2;
|
|
13492
|
+
}
|
|
13493
|
+
continue;
|
|
13494
|
+
}
|
|
13495
|
+
if (kind === "boolean") {
|
|
13496
|
+
flags[name] = negated ? "false" : "true";
|
|
13497
|
+
continue;
|
|
13498
|
+
}
|
|
13499
|
+
const value = args[index + 1];
|
|
13500
|
+
if (value === void 0 || value.startsWith("--")) {
|
|
13501
|
+
throw new CliUsageError(
|
|
13502
|
+
`--${externalName} requires a value`,
|
|
13503
|
+
definition.path[0]
|
|
13504
|
+
);
|
|
13505
|
+
}
|
|
13506
|
+
flags[name] = value;
|
|
13507
|
+
index++;
|
|
13508
|
+
}
|
|
13509
|
+
const command2 = definition.path.join(" ");
|
|
13510
|
+
if (flags.help !== void 0) {
|
|
13511
|
+
return {
|
|
13512
|
+
path: definition.path,
|
|
13513
|
+
flags,
|
|
13514
|
+
positionals
|
|
13515
|
+
};
|
|
13516
|
+
}
|
|
13517
|
+
if (positionals.length < definition.positionals.min) {
|
|
13518
|
+
const missingName = definition.positionals.names[positionals.length] ?? "argument";
|
|
13519
|
+
throw new CliUsageError(
|
|
13520
|
+
`Missing ${missingName} for '${command2}'`,
|
|
13521
|
+
definition.path[0]
|
|
13522
|
+
);
|
|
13523
|
+
}
|
|
13524
|
+
if (positionals.length > definition.positionals.max) {
|
|
13525
|
+
throw new CliUsageError(
|
|
13526
|
+
`Unexpected argument '${positionals[definition.positionals.max]}' for '${command2}'`,
|
|
13527
|
+
definition.path[0]
|
|
13528
|
+
);
|
|
13529
|
+
}
|
|
13530
|
+
return {
|
|
13531
|
+
path: definition.path,
|
|
13532
|
+
flags,
|
|
13533
|
+
positionals
|
|
13534
|
+
};
|
|
13535
|
+
}
|
|
13536
|
+
|
|
12898
13537
|
// src/cli/pkce.ts
|
|
12899
13538
|
import * as crypto from "crypto";
|
|
12900
13539
|
function generateCodeVerifier() {
|
|
@@ -12912,22 +13551,6 @@ var DEFAULT_BASE_URL2 = "https://api-llm.prd.alva.ai";
|
|
|
12912
13551
|
var DEFAULT_AUTH_URL = "https://alva.ai";
|
|
12913
13552
|
var CLIENT_ID = "alva-cli";
|
|
12914
13553
|
var SCOPE = "cli";
|
|
12915
|
-
function parseFlags(argv) {
|
|
12916
|
-
const flags = {};
|
|
12917
|
-
for (let i = 0; i < argv.length; i++) {
|
|
12918
|
-
const arg = argv[i];
|
|
12919
|
-
if (arg.startsWith("--")) {
|
|
12920
|
-
const eqIdx = arg.indexOf("=");
|
|
12921
|
-
if (eqIdx !== -1) {
|
|
12922
|
-
flags[arg.slice(2, eqIdx)] = arg.slice(eqIdx + 1);
|
|
12923
|
-
} else if (i + 1 < argv.length && !argv[i + 1].startsWith("--")) {
|
|
12924
|
-
flags[arg.slice(2)] = argv[i + 1];
|
|
12925
|
-
i++;
|
|
12926
|
-
}
|
|
12927
|
-
}
|
|
12928
|
-
}
|
|
12929
|
-
return flags;
|
|
12930
|
-
}
|
|
12931
13554
|
function defaultOpenBrowser(url) {
|
|
12932
13555
|
const platform = process.platform;
|
|
12933
13556
|
let cmd;
|
|
@@ -13026,7 +13649,7 @@ async function exchangeCodeForApiKey(params) {
|
|
|
13026
13649
|
var SUCCESS_HTML = `<html><body style="display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:rgba(246,246,246,1);font-family:system-ui,sans-serif"><div style="text-align:center;display:flex;flex-direction:column;align-items:center;gap:40px"><h1 style="font-size:45px;font-weight:400;line-height:120%;margin:0">Turn Ideas into Live<br>Investing Playbooks in Minutes</h1><p style="font-size:24px;font-weight:400;margin:0">You're all set for Alva.</p></div></body></html>`;
|
|
13027
13650
|
async function handleAuthLogin(args, deps) {
|
|
13028
13651
|
const d = { ...defaultDeps(), ...deps };
|
|
13029
|
-
const flags =
|
|
13652
|
+
const flags = parseCommand(args).flags;
|
|
13030
13653
|
const profileName = flags.profile || "default";
|
|
13031
13654
|
const authUrl = flags["auth-url"] || DEFAULT_AUTH_URL;
|
|
13032
13655
|
const baseUrl = flags["base-url"] || DEFAULT_BASE_URL2;
|
|
@@ -13260,7 +13883,7 @@ function defaultNoBrowserDeps() {
|
|
|
13260
13883
|
}
|
|
13261
13884
|
async function handleAuthLoginNoBrowser(args, deps) {
|
|
13262
13885
|
const d = { ...defaultNoBrowserDeps(), ...deps };
|
|
13263
|
-
const flags =
|
|
13886
|
+
const flags = parseCommand(args).flags;
|
|
13264
13887
|
const profileName = flags.profile || "default";
|
|
13265
13888
|
const authUrl = flags["auth-url"] || DEFAULT_AUTH_URL;
|
|
13266
13889
|
const baseUrl = flags["base-url"] || DEFAULT_BASE_URL2;
|
|
@@ -13628,6 +14251,9 @@ function formatAlertList(result) {
|
|
|
13628
14251
|
const status = alert.target_status ? ` [${alert.target_status}]` : "";
|
|
13629
14252
|
lines.push(`\u2022 ${alertTitle(alert)}${status}`);
|
|
13630
14253
|
lines.push(` target: ${targetType} ${alert.target?.id ?? ""}`.trimEnd());
|
|
14254
|
+
if (alert.channel_id !== void 0) {
|
|
14255
|
+
lines.push(` channel: ${alert.channel_id}`);
|
|
14256
|
+
}
|
|
13631
14257
|
if (alert.kind) lines.push(` kind: ${alert.kind}`);
|
|
13632
14258
|
if (alert.feed_status)
|
|
13633
14259
|
lines.push(` automation status: ${alert.feed_status}`);
|
|
@@ -13671,10 +14297,23 @@ import * as fs2 from "fs";
|
|
|
13671
14297
|
import * as os2 from "os";
|
|
13672
14298
|
import * as fsPromises2 from "fs/promises";
|
|
13673
14299
|
import { Agent, setGlobalDispatcher } from "undici";
|
|
13674
|
-
var CLI_VERSION = true ? "0.
|
|
14300
|
+
var CLI_VERSION = true ? "0.20.0" : "dev";
|
|
13675
14301
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
13676
14302
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
13677
14303
|
var configuredRunFetchTimeoutMs;
|
|
14304
|
+
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
14305
|
+
var GLOBAL_VALUE_FLAG_SET = new Set(GLOBAL_VALUE_FLAGS);
|
|
14306
|
+
var BOOLEAN_FLAGS = (() => {
|
|
14307
|
+
const flags = new Set(
|
|
14308
|
+
Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "boolean").map(([name]) => name)
|
|
14309
|
+
);
|
|
14310
|
+
for (const definition of COMMAND_DEFINITIONS) {
|
|
14311
|
+
for (const [name, kind] of Object.entries(definition.flags)) {
|
|
14312
|
+
if (kind === "boolean") flags.add(name);
|
|
14313
|
+
}
|
|
14314
|
+
}
|
|
14315
|
+
return flags;
|
|
14316
|
+
})();
|
|
13678
14317
|
function isVersionOlderThan(a, b) {
|
|
13679
14318
|
const parse4 = (v) => {
|
|
13680
14319
|
if (!v) return null;
|
|
@@ -13801,8 +14440,9 @@ Verify that your credentials are valid by calling the Alva API. Shows your
|
|
|
13801
14440
|
username, subscription tier, and which profile/endpoint is being used.
|
|
13802
14441
|
Use this after 'alva configure' to confirm everything works.
|
|
13803
14442
|
|
|
13804
|
-
Output
|
|
13805
|
-
|
|
14443
|
+
Output includes active_im_provider (telegram, discord, slack, whatsapp,
|
|
14444
|
+
imessage, or empty) and _meta.arrays_jwt (exists, expires_at, renewal_needed,
|
|
14445
|
+
tier). arrays_jwt is omitted when the backend status call fails.
|
|
13806
14446
|
|
|
13807
14447
|
Examples:
|
|
13808
14448
|
alva whoami
|
|
@@ -13821,7 +14461,7 @@ Response fields:
|
|
|
13821
14461
|
slack_username Slack display name if connected, empty otherwise
|
|
13822
14462
|
whatsapp_username WhatsApp display name if connected, empty otherwise
|
|
13823
14463
|
imessage_username iMessage display name if connected, empty otherwise
|
|
13824
|
-
|
|
14464
|
+
active_im_provider Currently selected IM provider
|
|
13825
14465
|
|
|
13826
14466
|
Examples:
|
|
13827
14467
|
alva user me`,
|
|
@@ -13984,6 +14624,7 @@ Subcommands:
|
|
|
13984
14624
|
resume Resume a paused cronjob
|
|
13985
14625
|
trigger Fire the cronjob once, immediately, bypassing the schedule
|
|
13986
14626
|
(returns workflow_run_id; poll 'run-status' with a timeout)
|
|
14627
|
+
This is not a dry run and may deliver Feed alerts to subscribers.
|
|
13987
14628
|
runs List runs for a cronjob (cursor-paginated)
|
|
13988
14629
|
run-status Get one triggered run's pollable status by workflow_run_id
|
|
13989
14630
|
run-logs Get stdout/stderr logs for a single cronjob run
|
|
@@ -13993,9 +14634,10 @@ Create/Update flags:
|
|
|
13993
14634
|
--path <path> Path to script on ALFS (required on create, must exist)
|
|
13994
14635
|
--cron <expression> Cron expression (required on create, e.g. "0 */4 * * *")
|
|
13995
14636
|
--args <json> JSON object passed to require("env").args
|
|
13996
|
-
--push-notify
|
|
13997
|
-
--no-push-notify Disable
|
|
14637
|
+
--push-notify Let successful Feed runs deliver declared alert outputs
|
|
14638
|
+
--no-push-notify Disable Feed alert delivery
|
|
13998
14639
|
--max-heap-size-mb <mb> Override per-cronjob V8 heap limit (1-2046, default uses server config)
|
|
14640
|
+
--execution-timeout-seconds <seconds> Wall-clock timeout (1-3600; create default: 1800; update omitted: unchanged)
|
|
13999
14641
|
--run-as-service-account <id> Run the cronjob under a service-account identity
|
|
14000
14642
|
(id from "alva service-account create"); restricts file
|
|
14001
14643
|
access to the SA's grants. Omit on update \u21D2 unchanged (#602)
|
|
@@ -14048,6 +14690,8 @@ Examples:
|
|
|
14048
14690
|
alva deploy run-logs --id 42 --run-id 123
|
|
14049
14691
|
|
|
14050
14692
|
Build-time verify (fire once, then poll up to 5 minutes):
|
|
14693
|
+
WARNING: trigger uses production delivery semantics. If --push-notify and
|
|
14694
|
+
subscriber alert bindings are enabled, this run may send real notifications.
|
|
14051
14695
|
WF=$(alva deploy trigger --id 42 | jq -r .workflow_run_id)
|
|
14052
14696
|
for _ in {1..60}; do
|
|
14053
14697
|
STATUS_JSON=$(alva deploy run-status --id 42 --workflow-run-id "$WF")
|
|
@@ -14062,9 +14706,9 @@ Build-time verify (fire once, then poll up to 5 minutes):
|
|
|
14062
14706
|
--run-id "$(echo "$STATUS_JSON" | jq -r .run.id)"`,
|
|
14063
14707
|
loop: `Usage: alva loop <subcommand> [options]
|
|
14064
14708
|
|
|
14065
|
-
Create a bounded, self-scheduled in
|
|
14066
|
-
fire-and-forget agent turn on
|
|
14067
|
-
@alva/loop SDK), continuing that
|
|
14709
|
+
Create a bounded, self-scheduled goal loop in an Alva channel. Each tick runs
|
|
14710
|
+
one fire-and-forget agent turn on the Alva channel's stable main
|
|
14711
|
+
session (via the @alva/loop SDK), continuing that conversation toward a goal. Creation
|
|
14068
14712
|
seeds a shared runner, creates its cronjob, and registers the cronjob as an
|
|
14069
14713
|
Automation without starting an extra publish-time run.
|
|
14070
14714
|
|
|
@@ -14074,7 +14718,8 @@ Subcommands:
|
|
|
14074
14718
|
Create flags:
|
|
14075
14719
|
--goal <text> Instruction run each tick (required)
|
|
14076
14720
|
--cron <expression> Cron schedule (required, e.g. "0 * * * *")
|
|
14077
|
-
--channel-id <id> Target channel
|
|
14721
|
+
--channel-id <id> Target Alva channel ID. Omit \u21D2 your default
|
|
14722
|
+
Alva agent channel
|
|
14078
14723
|
--start <time> First eligible time: 'now' (default) or RFC3339
|
|
14079
14724
|
--until <time> Exclusive RFC3339 cutoff
|
|
14080
14725
|
--runs <count> Maximum admitted runs after --start
|
|
@@ -14154,8 +14799,9 @@ Examples:
|
|
|
14154
14799
|
|
|
14155
14800
|
Manage alerts. Alert subscriptions target automations (feeds) only. Playbook
|
|
14156
14801
|
follows are independent; delivery history and global preferences live here too.
|
|
14157
|
-
Personal alerts may be routed to different Alva
|
|
14158
|
-
are managed explicitly through "alert group" and target the current
|
|
14802
|
+
Personal alerts may be routed to different Alva channels. External IM
|
|
14803
|
+
group alerts are managed explicitly through "alert group" and target the current
|
|
14804
|
+
group.
|
|
14159
14805
|
|
|
14160
14806
|
Subcommands:
|
|
14161
14807
|
list List the caller's active alerts
|
|
@@ -14168,20 +14814,20 @@ Subcommands:
|
|
|
14168
14814
|
enable-session-completed
|
|
14169
14815
|
disable-session-completed
|
|
14170
14816
|
|
|
14171
|
-
Target flags:
|
|
14817
|
+
Target flags (choose one):
|
|
14172
14818
|
--automation <owner/name> Automation target
|
|
14173
|
-
|
|
14174
|
-
Enable/disable-by-id flags:
|
|
14175
14819
|
--automation-ids <a,b> Comma-separated automation target ids
|
|
14176
|
-
|
|
14820
|
+
|
|
14821
|
+
Enable routing:
|
|
14822
|
+
--channel-id <id> Alva channel ID for name or id targets (optional)
|
|
14177
14823
|
|
|
14178
14824
|
Group subcommands:
|
|
14179
14825
|
alva alert group list
|
|
14180
14826
|
alva alert group enable --automation-ids <id>
|
|
14181
14827
|
alva alert group disable --automation-ids <id>
|
|
14182
14828
|
|
|
14183
|
-
Group commands must run inside the attached
|
|
14184
|
-
group is inferred automatically; there is no session-id argument.
|
|
14829
|
+
Group commands must run inside the attached external IM-group sandbox. The
|
|
14830
|
+
current group is inferred automatically; there is no session-id argument.
|
|
14185
14831
|
|
|
14186
14832
|
List flags:
|
|
14187
14833
|
--first <n> Optional page size
|
|
@@ -14193,7 +14839,7 @@ Follows flags:
|
|
|
14193
14839
|
--cursor <token> Optional cursor from previous response
|
|
14194
14840
|
|
|
14195
14841
|
History flags:
|
|
14196
|
-
--
|
|
14842
|
+
--delivery-provider <name> Optional provider filter (telegram, web, ...)
|
|
14197
14843
|
--status <status> Optional status filter (sent, failed, filtered)
|
|
14198
14844
|
--since <seconds> Optional Unix seconds lower bound
|
|
14199
14845
|
|
|
@@ -14607,7 +15253,7 @@ Subcommands:
|
|
|
14607
15253
|
Common flags:
|
|
14608
15254
|
--username <user> Owner's username (required)
|
|
14609
15255
|
--name <name> URL-safe feed name (required)
|
|
14610
|
-
--
|
|
15256
|
+
--delivery-provider <name> Optional provider filter (telegram, web, ...)
|
|
14611
15257
|
--status <status> Optional status filter (sent, failed, filtered)
|
|
14612
15258
|
--since <seconds> Optional Unix seconds lower bound
|
|
14613
15259
|
--first <n> Optional page size (default 50, max 200 server-side)
|
|
@@ -14679,7 +15325,7 @@ Name-addressed flags:
|
|
|
14679
15325
|
|
|
14680
15326
|
Batch flags:
|
|
14681
15327
|
--feed-ids <a,b> Comma-separated feed target ids
|
|
14682
|
-
--channel-id <id>
|
|
15328
|
+
--channel-id <id> Alva channel ID for subscribe (optional)
|
|
14683
15329
|
|
|
14684
15330
|
List flags:
|
|
14685
15331
|
--first <n> Optional page size (response carries total_count \u2014
|
|
@@ -14840,7 +15486,7 @@ Examples:
|
|
|
14840
15486
|
alva arrays token status`
|
|
14841
15487
|
};
|
|
14842
15488
|
async function handleConfigure(args, deps) {
|
|
14843
|
-
const flags =
|
|
15489
|
+
const flags = parseCommand(args).flags;
|
|
14844
15490
|
const apiKey = flags["api-key"];
|
|
14845
15491
|
if (!apiKey) {
|
|
14846
15492
|
throw new CliUsageError("--api-key is required", "configure");
|
|
@@ -14878,36 +15524,17 @@ async function handleConfigure(args, deps) {
|
|
|
14878
15524
|
profile: profileName
|
|
14879
15525
|
};
|
|
14880
15526
|
}
|
|
14881
|
-
|
|
14882
|
-
"recursive",
|
|
14883
|
-
"mkdir-parents",
|
|
14884
|
-
"append",
|
|
14885
|
-
"push-notify",
|
|
14886
|
-
"help",
|
|
14887
|
-
"execute-latest",
|
|
14888
|
-
"dry-run",
|
|
14889
|
-
"allow-charges",
|
|
14890
|
-
"clear-run-as",
|
|
14891
|
-
"json",
|
|
14892
|
-
"compress",
|
|
14893
|
-
"bypass-lint",
|
|
14894
|
-
"no-browser",
|
|
14895
|
-
"browser",
|
|
14896
|
-
"base64",
|
|
14897
|
-
"full",
|
|
14898
|
-
"today"
|
|
14899
|
-
]);
|
|
14900
|
-
function parseFlags2(argv) {
|
|
15527
|
+
function parseFlags(argv) {
|
|
14901
15528
|
const flags = {};
|
|
14902
|
-
for (let
|
|
14903
|
-
const
|
|
14904
|
-
if (!
|
|
14905
|
-
const
|
|
14906
|
-
if (
|
|
14907
|
-
flags[
|
|
15529
|
+
for (let index = 0; index < argv.length; index++) {
|
|
15530
|
+
const argument = argv[index];
|
|
15531
|
+
if (!argument.startsWith("--")) continue;
|
|
15532
|
+
const equalsIndex = argument.indexOf("=");
|
|
15533
|
+
if (equalsIndex !== -1) {
|
|
15534
|
+
flags[argument.slice(2, equalsIndex)] = argument.slice(equalsIndex + 1);
|
|
14908
15535
|
continue;
|
|
14909
15536
|
}
|
|
14910
|
-
const name =
|
|
15537
|
+
const name = argument.slice(2);
|
|
14911
15538
|
if (BOOLEAN_FLAGS.has(name)) {
|
|
14912
15539
|
flags[name] = "true";
|
|
14913
15540
|
continue;
|
|
@@ -14916,18 +15543,12 @@ function parseFlags2(argv) {
|
|
|
14916
15543
|
flags[name.slice(3)] = "false";
|
|
14917
15544
|
continue;
|
|
14918
15545
|
}
|
|
14919
|
-
const
|
|
14920
|
-
if (
|
|
14921
|
-
throw new CliUsageError(
|
|
14922
|
-
`--${name} requires a value`,
|
|
14923
|
-
// Group is best-effort: first non-flag arg of the original
|
|
14924
|
-
// argv. parseFlags doesn't track group, so just use the flag
|
|
14925
|
-
// name as a fallback hint.
|
|
14926
|
-
name
|
|
14927
|
-
);
|
|
15546
|
+
const value = argv[index + 1];
|
|
15547
|
+
if (value === void 0 || value.startsWith("--")) {
|
|
15548
|
+
throw new CliUsageError(`--${name} requires a value`, name);
|
|
14928
15549
|
}
|
|
14929
|
-
flags[name] =
|
|
14930
|
-
|
|
15550
|
+
flags[name] = value;
|
|
15551
|
+
index++;
|
|
14931
15552
|
}
|
|
14932
15553
|
return flags;
|
|
14933
15554
|
}
|
|
@@ -14936,106 +15557,106 @@ function boolFlag(val) {
|
|
|
14936
15557
|
if (val === "false") return false;
|
|
14937
15558
|
return void 0;
|
|
14938
15559
|
}
|
|
14939
|
-
function requireFlag(flags, name,
|
|
15560
|
+
function requireFlag(flags, name, command2) {
|
|
14940
15561
|
const val = flags[name];
|
|
14941
15562
|
if (val === void 0) {
|
|
14942
|
-
const group =
|
|
14943
|
-
throw new CliUsageError(`--${name} is required for '${
|
|
15563
|
+
const group = command2.split(" ")[0];
|
|
15564
|
+
throw new CliUsageError(`--${name} is required for '${command2}'`, group);
|
|
14944
15565
|
}
|
|
14945
15566
|
return val;
|
|
14946
15567
|
}
|
|
14947
|
-
function requireNumericFlag(flags, name,
|
|
14948
|
-
const val = requireFlag(flags, name,
|
|
15568
|
+
function requireNumericFlag(flags, name, command2) {
|
|
15569
|
+
const val = requireFlag(flags, name, command2);
|
|
14949
15570
|
const n = Number(val);
|
|
14950
15571
|
if (Number.isNaN(n)) {
|
|
14951
|
-
const group =
|
|
15572
|
+
const group = command2.split(" ")[0];
|
|
14952
15573
|
throw new CliUsageError(
|
|
14953
|
-
`--${name} must be a number for '${
|
|
15574
|
+
`--${name} must be a number for '${command2}', got '${val}'`,
|
|
14954
15575
|
group
|
|
14955
15576
|
);
|
|
14956
15577
|
}
|
|
14957
15578
|
return n;
|
|
14958
15579
|
}
|
|
14959
|
-
function requirePositiveIntegerFlag(flags, name,
|
|
14960
|
-
const val = requireFlag(flags, name,
|
|
15580
|
+
function requirePositiveIntegerFlag(flags, name, command2) {
|
|
15581
|
+
const val = requireFlag(flags, name, command2);
|
|
14961
15582
|
if (!/^[1-9]\d*$/.test(val)) {
|
|
14962
|
-
const group =
|
|
15583
|
+
const group = command2.split(" ")[0];
|
|
14963
15584
|
throw new CliUsageError(
|
|
14964
|
-
`--${name} must be a positive integer for '${
|
|
15585
|
+
`--${name} must be a positive integer for '${command2}', got '${val}'`,
|
|
14965
15586
|
group
|
|
14966
15587
|
);
|
|
14967
15588
|
}
|
|
14968
15589
|
return Number(val);
|
|
14969
15590
|
}
|
|
14970
|
-
function requirePositiveIntegerStringFlag(flags, name,
|
|
14971
|
-
const val = requireFlag(flags, name,
|
|
15591
|
+
function requirePositiveIntegerStringFlag(flags, name, command2) {
|
|
15592
|
+
const val = requireFlag(flags, name, command2);
|
|
14972
15593
|
if (!/^[1-9]\d*$/.test(val)) {
|
|
14973
|
-
const group =
|
|
15594
|
+
const group = command2.split(" ")[0];
|
|
14974
15595
|
throw new CliUsageError(
|
|
14975
|
-
`--${name} must be a positive integer for '${
|
|
15596
|
+
`--${name} must be a positive integer for '${command2}', got '${val}'`,
|
|
14976
15597
|
group
|
|
14977
15598
|
);
|
|
14978
15599
|
}
|
|
14979
15600
|
return val;
|
|
14980
15601
|
}
|
|
14981
|
-
function optionalBoundedIntegerFlag(flags, name,
|
|
15602
|
+
function optionalBoundedIntegerFlag(flags, name, command2, min, max) {
|
|
14982
15603
|
const val = flags[name];
|
|
14983
15604
|
if (val === void 0) return void 0;
|
|
14984
15605
|
const n = Number(val);
|
|
14985
15606
|
if (!Number.isInteger(n) || n < min || n > max) {
|
|
14986
|
-
const group =
|
|
15607
|
+
const group = command2.split(" ")[0];
|
|
14987
15608
|
throw new CliUsageError(
|
|
14988
|
-
`--${name} must be an integer between ${min} and ${max} for '${
|
|
15609
|
+
`--${name} must be an integer between ${min} and ${max} for '${command2}', got '${val}'`,
|
|
14989
15610
|
group
|
|
14990
15611
|
);
|
|
14991
15612
|
}
|
|
14992
15613
|
return n;
|
|
14993
15614
|
}
|
|
14994
|
-
function optionalServiceAccountIdFlag(flags,
|
|
15615
|
+
function optionalServiceAccountIdFlag(flags, command2) {
|
|
14995
15616
|
const raw = flags["run-as-service-account"];
|
|
14996
15617
|
if (raw === void 0) return void 0;
|
|
14997
15618
|
if (!/^[1-9]\d*$/.test(raw)) {
|
|
14998
15619
|
throw new CliUsageError(
|
|
14999
|
-
`--run-as-service-account must be a positive service-account id for '${
|
|
15000
|
-
|
|
15620
|
+
`--run-as-service-account must be a positive service-account id for '${command2}', got '${raw}'`,
|
|
15621
|
+
command2.split(" ")[0]
|
|
15001
15622
|
);
|
|
15002
15623
|
}
|
|
15003
15624
|
return raw;
|
|
15004
15625
|
}
|
|
15005
|
-
function resolveRunAsFlag(flags,
|
|
15626
|
+
function resolveRunAsFlag(flags, command2) {
|
|
15006
15627
|
const clear = boolFlag(flags["clear-run-as"]) ?? false;
|
|
15007
|
-
const setID = optionalServiceAccountIdFlag(flags,
|
|
15628
|
+
const setID = optionalServiceAccountIdFlag(flags, command2);
|
|
15008
15629
|
if (clear && setID !== void 0) {
|
|
15009
15630
|
throw new CliUsageError(
|
|
15010
|
-
`--clear-run-as and --run-as-service-account are mutually exclusive for '${
|
|
15011
|
-
|
|
15631
|
+
`--clear-run-as and --run-as-service-account are mutually exclusive for '${command2}'`,
|
|
15632
|
+
command2.split(" ")[0]
|
|
15012
15633
|
);
|
|
15013
15634
|
}
|
|
15014
15635
|
if (clear) return "0";
|
|
15015
15636
|
return setID;
|
|
15016
15637
|
}
|
|
15017
|
-
function requireServiceAccountIdFlag(flags,
|
|
15638
|
+
function requireServiceAccountIdFlag(flags, command2) {
|
|
15018
15639
|
const raw = flags["id"];
|
|
15019
15640
|
if (raw === void 0 || raw === "") {
|
|
15020
15641
|
throw new CliUsageError(
|
|
15021
|
-
`Missing required flag --id for '${
|
|
15022
|
-
|
|
15642
|
+
`Missing required flag --id for '${command2}'`,
|
|
15643
|
+
command2.split(" ")[0]
|
|
15023
15644
|
);
|
|
15024
15645
|
}
|
|
15025
15646
|
if (!/^[1-9]\d*$/.test(raw)) {
|
|
15026
15647
|
throw new CliUsageError(
|
|
15027
|
-
`--id must be a positive service-account id for '${
|
|
15028
|
-
|
|
15648
|
+
`--id must be a positive service-account id for '${command2}', got '${raw}'`,
|
|
15649
|
+
command2.split(" ")[0]
|
|
15029
15650
|
);
|
|
15030
15651
|
}
|
|
15031
15652
|
return raw;
|
|
15032
15653
|
}
|
|
15033
|
-
function parsePositiveIntegerValue(val, label,
|
|
15654
|
+
function parsePositiveIntegerValue(val, label, command2) {
|
|
15034
15655
|
const n = Number(val);
|
|
15035
15656
|
if (!/^[1-9]\d*$/.test(val) || !Number.isSafeInteger(n)) {
|
|
15036
|
-
const group =
|
|
15657
|
+
const group = command2.split(" ")[0];
|
|
15037
15658
|
throw new CliUsageError(
|
|
15038
|
-
`${label} must be a positive integer for '${
|
|
15659
|
+
`${label} must be a positive integer for '${command2}', got '${val}'`,
|
|
15039
15660
|
group
|
|
15040
15661
|
);
|
|
15041
15662
|
}
|
|
@@ -15069,50 +15690,80 @@ function configureRunFetchTimeout(timeoutMs, deps) {
|
|
|
15069
15690
|
);
|
|
15070
15691
|
configuredRunFetchTimeoutMs = timeoutMs;
|
|
15071
15692
|
}
|
|
15072
|
-
function requireCurrentGroupAlertSessionID(client,
|
|
15693
|
+
function requireCurrentGroupAlertSessionID(client, command2) {
|
|
15073
15694
|
if (client.originSessionKind !== "channel_group") {
|
|
15074
15695
|
throw new CliUsageError(
|
|
15075
|
-
`'${
|
|
15696
|
+
`'${command2}' is only available inside an external IM-group sandbox`,
|
|
15076
15697
|
"alert"
|
|
15077
15698
|
);
|
|
15078
15699
|
}
|
|
15079
15700
|
const sessionID = client.originSessionId;
|
|
15080
15701
|
if (sessionID === void 0) {
|
|
15081
15702
|
throw new CliUsageError(
|
|
15082
|
-
`current group session is unavailable for '${
|
|
15703
|
+
`current group session is unavailable for '${command2}'`,
|
|
15083
15704
|
"alert"
|
|
15084
15705
|
);
|
|
15085
15706
|
}
|
|
15086
15707
|
if (!/^[1-9]\d*$/.test(sessionID)) {
|
|
15087
15708
|
throw new CliUsageError(
|
|
15088
|
-
`current group session must be a positive integer for '${
|
|
15709
|
+
`current group session must be a positive integer for '${command2}', got '${sessionID}'`,
|
|
15089
15710
|
"alert"
|
|
15090
15711
|
);
|
|
15091
15712
|
}
|
|
15092
15713
|
return sessionID;
|
|
15093
15714
|
}
|
|
15094
|
-
function requireSingleGroupAlertFeedID(flags,
|
|
15715
|
+
function requireSingleGroupAlertFeedID(flags, command2) {
|
|
15095
15716
|
if (flags.automation !== void 0) {
|
|
15096
15717
|
throw new CliUsageError(
|
|
15097
|
-
`Group alerts require --automation-ids for '${
|
|
15718
|
+
`Group alerts require --automation-ids for '${command2}'`,
|
|
15098
15719
|
"alert"
|
|
15099
15720
|
);
|
|
15100
15721
|
}
|
|
15101
15722
|
if (flags["channel-id"] !== void 0) {
|
|
15102
15723
|
throw new CliUsageError(
|
|
15103
|
-
`--channel-id selects
|
|
15724
|
+
`--channel-id selects an Alva channel; omit it for '${command2}'`,
|
|
15104
15725
|
"alert"
|
|
15105
15726
|
);
|
|
15106
15727
|
}
|
|
15107
15728
|
const ids = csvList(flags["automation-ids"]) ?? [];
|
|
15108
15729
|
if (ids.length !== 1 || !/^[1-9]\d*$/.test(ids[0])) {
|
|
15109
15730
|
throw new CliUsageError(
|
|
15110
|
-
`Group alerts require exactly one positive --automation-ids value for '${
|
|
15731
|
+
`Group alerts require exactly one positive --automation-ids value for '${command2}'`,
|
|
15111
15732
|
"alert"
|
|
15112
15733
|
);
|
|
15113
15734
|
}
|
|
15114
15735
|
return ids[0];
|
|
15115
15736
|
}
|
|
15737
|
+
function deliveryProviderFilter(flags, command2) {
|
|
15738
|
+
if (flags["channel"] !== void 0) {
|
|
15739
|
+
throw new CliUsageError(
|
|
15740
|
+
`--channel is no longer supported for '${command2}'; use --delivery-provider`,
|
|
15741
|
+
command2.split(" ")[0]
|
|
15742
|
+
);
|
|
15743
|
+
}
|
|
15744
|
+
return flags["delivery-provider"];
|
|
15745
|
+
}
|
|
15746
|
+
function projectUserProfileForCLI(record) {
|
|
15747
|
+
const { active_channel: activeIMProvider, ...profile } = record;
|
|
15748
|
+
return { ...profile, active_im_provider: activeIMProvider };
|
|
15749
|
+
}
|
|
15750
|
+
function projectNotificationHistoryForCLI(response) {
|
|
15751
|
+
if (response === null || typeof response !== "object" || Array.isArray(response)) {
|
|
15752
|
+
return response;
|
|
15753
|
+
}
|
|
15754
|
+
const record = response;
|
|
15755
|
+
if (!Array.isArray(record.items)) return response;
|
|
15756
|
+
return {
|
|
15757
|
+
...record,
|
|
15758
|
+
items: record.items.map((item) => {
|
|
15759
|
+
if (item === null || typeof item !== "object" || Array.isArray(item)) {
|
|
15760
|
+
return item;
|
|
15761
|
+
}
|
|
15762
|
+
const { channel: deliveryProvider, ...event } = item;
|
|
15763
|
+
return { ...event, delivery_provider: deliveryProvider };
|
|
15764
|
+
})
|
|
15765
|
+
};
|
|
15766
|
+
}
|
|
15116
15767
|
function num(val) {
|
|
15117
15768
|
if (val === void 0) return void 0;
|
|
15118
15769
|
const n = Number(val);
|
|
@@ -15123,37 +15774,37 @@ function csvList(val) {
|
|
|
15123
15774
|
const values = val.split(",").map((item) => item.trim()).filter(Boolean);
|
|
15124
15775
|
return values.length > 0 ? values : void 0;
|
|
15125
15776
|
}
|
|
15126
|
-
function parseOwnerNameTarget(value, flag,
|
|
15777
|
+
function parseOwnerNameTarget(value, flag, command2) {
|
|
15127
15778
|
const [username, ...rest] = value.split("/");
|
|
15128
15779
|
const name = rest.join("/");
|
|
15129
15780
|
if (!username || !name || name.includes("/")) {
|
|
15130
15781
|
throw new CliUsageError(
|
|
15131
|
-
`--${flag} must be in owner/name form for '${
|
|
15132
|
-
|
|
15782
|
+
`--${flag} must be in owner/name form for '${command2}', got '${value}'`,
|
|
15783
|
+
command2.split(" ")[0]
|
|
15133
15784
|
);
|
|
15134
15785
|
}
|
|
15135
15786
|
return { username, name };
|
|
15136
15787
|
}
|
|
15137
|
-
function rejectPlaybookAlertTarget(flags,
|
|
15788
|
+
function rejectPlaybookAlertTarget(flags, command2) {
|
|
15138
15789
|
if (flags["playbook"] !== void 0 || flags["playbook-ids"] !== void 0) {
|
|
15139
15790
|
throw new CliUsageError(
|
|
15140
|
-
`Playbook alert targets are unsupported for '${
|
|
15791
|
+
`Playbook alert targets are unsupported for '${command2}'; use --automation or --automation-ids`,
|
|
15141
15792
|
"alert"
|
|
15142
15793
|
);
|
|
15143
15794
|
}
|
|
15144
15795
|
}
|
|
15145
|
-
function requireAutomationAlertTarget(flags,
|
|
15796
|
+
function requireAutomationAlertTarget(flags, command2) {
|
|
15146
15797
|
return parseOwnerNameTarget(
|
|
15147
|
-
requireFlag(flags, "automation",
|
|
15798
|
+
requireFlag(flags, "automation", command2),
|
|
15148
15799
|
"automation",
|
|
15149
|
-
|
|
15800
|
+
command2
|
|
15150
15801
|
);
|
|
15151
15802
|
}
|
|
15152
|
-
function feedReleaseParams(flags,
|
|
15803
|
+
function feedReleaseParams(flags, command2) {
|
|
15153
15804
|
return {
|
|
15154
|
-
name: requireFlag(flags, "name",
|
|
15155
|
-
version: requireFlag(flags, "version",
|
|
15156
|
-
cronjob_id: requireNumericFlag(flags, "cronjob-id",
|
|
15805
|
+
name: requireFlag(flags, "name", command2),
|
|
15806
|
+
version: requireFlag(flags, "version", command2),
|
|
15807
|
+
cronjob_id: requireNumericFlag(flags, "cronjob-id", command2),
|
|
15157
15808
|
view_json: jsonParse(flags["view-json"]),
|
|
15158
15809
|
description: flags["description"],
|
|
15159
15810
|
changelog: flags["changelog"],
|
|
@@ -15189,7 +15840,7 @@ function feedVisibility(val) {
|
|
|
15189
15840
|
"feed"
|
|
15190
15841
|
);
|
|
15191
15842
|
}
|
|
15192
|
-
function parseCreditsTimestamp(value, flag,
|
|
15843
|
+
function parseCreditsTimestamp(value, flag, command2) {
|
|
15193
15844
|
const trimmed = value.trim();
|
|
15194
15845
|
if (/^\d+$/.test(trimmed)) {
|
|
15195
15846
|
const ms = Number(trimmed);
|
|
@@ -15199,8 +15850,8 @@ function parseCreditsTimestamp(value, flag, command) {
|
|
|
15199
15850
|
const parsed = Date.parse(normalized);
|
|
15200
15851
|
if (Number.isNaN(parsed)) {
|
|
15201
15852
|
throw new CliUsageError(
|
|
15202
|
-
`--${flag} must be an ISO time, YYYY-MM-DD, or Unix ms for '${
|
|
15203
|
-
|
|
15853
|
+
`--${flag} must be an ISO time, YYYY-MM-DD, or Unix ms for '${command2}', got '${value}'`,
|
|
15854
|
+
command2.split(" ")[0]
|
|
15204
15855
|
);
|
|
15205
15856
|
}
|
|
15206
15857
|
return parsed;
|
|
@@ -15305,7 +15956,7 @@ function loopAutomationDescription(goal) {
|
|
|
15305
15956
|
return prefix + Array.from(goal).slice(0, availableGoalRunes).join("");
|
|
15306
15957
|
}
|
|
15307
15958
|
function parseCreditsItemsParams(flags) {
|
|
15308
|
-
const
|
|
15959
|
+
const command2 = "credits items";
|
|
15309
15960
|
const hasToday = boolFlag(flags["today"]) === true;
|
|
15310
15961
|
const hasLast = flags["last"] !== void 0;
|
|
15311
15962
|
const hasStart = flags["start"] !== void 0;
|
|
@@ -15338,8 +15989,8 @@ function parseCreditsItemsParams(flags) {
|
|
|
15338
15989
|
endAtMs = Date.now();
|
|
15339
15990
|
startAtMs = endAtMs - durationMs;
|
|
15340
15991
|
} else {
|
|
15341
|
-
startAtMs = parseCreditsTimestamp(flags["start"], "start",
|
|
15342
|
-
endAtMs = parseCreditsTimestamp(flags["end"], "end",
|
|
15992
|
+
startAtMs = parseCreditsTimestamp(flags["start"], "start", command2);
|
|
15993
|
+
endAtMs = parseCreditsTimestamp(flags["end"], "end", command2);
|
|
15343
15994
|
}
|
|
15344
15995
|
if (endAtMs <= startAtMs) {
|
|
15345
15996
|
throw new CliUsageError(
|
|
@@ -15351,7 +16002,7 @@ function parseCreditsItemsParams(flags) {
|
|
|
15351
16002
|
startAtMs,
|
|
15352
16003
|
endAtMs,
|
|
15353
16004
|
sessionId: flags["session-id"],
|
|
15354
|
-
first: optionalBoundedIntegerFlag(flags, "first",
|
|
16005
|
+
first: optionalBoundedIntegerFlag(flags, "first", command2, 1, 500),
|
|
15355
16006
|
after: flags["after"]
|
|
15356
16007
|
};
|
|
15357
16008
|
}
|
|
@@ -15363,7 +16014,7 @@ function jsonParse(val) {
|
|
|
15363
16014
|
return val;
|
|
15364
16015
|
}
|
|
15365
16016
|
}
|
|
15366
|
-
function jsonObjectFlag(flags, name,
|
|
16017
|
+
function jsonObjectFlag(flags, name, command2) {
|
|
15367
16018
|
const raw = flags[name];
|
|
15368
16019
|
if (raw === void 0) return void 0;
|
|
15369
16020
|
let parsed;
|
|
@@ -15371,68 +16022,68 @@ function jsonObjectFlag(flags, name, command) {
|
|
|
15371
16022
|
parsed = JSON.parse(raw);
|
|
15372
16023
|
} catch {
|
|
15373
16024
|
throw new CliUsageError(
|
|
15374
|
-
`--${name} must be valid JSON for '${
|
|
15375
|
-
|
|
16025
|
+
`--${name} must be valid JSON for '${command2}'`,
|
|
16026
|
+
command2.split(" ")[0]
|
|
15376
16027
|
);
|
|
15377
16028
|
}
|
|
15378
16029
|
if (parsed === null || Array.isArray(parsed) || typeof parsed !== "object") {
|
|
15379
16030
|
throw new CliUsageError(
|
|
15380
|
-
`--${name} must be a JSON object for '${
|
|
15381
|
-
|
|
16031
|
+
`--${name} must be a JSON object for '${command2}'`,
|
|
16032
|
+
command2.split(" ")[0]
|
|
15382
16033
|
);
|
|
15383
16034
|
}
|
|
15384
16035
|
return parsed;
|
|
15385
16036
|
}
|
|
15386
|
-
function jsonRequiredFlag(flags, name,
|
|
15387
|
-
const raw = requireFlag(flags, name,
|
|
16037
|
+
function jsonRequiredFlag(flags, name, command2) {
|
|
16038
|
+
const raw = requireFlag(flags, name, command2);
|
|
15388
16039
|
try {
|
|
15389
16040
|
return JSON.parse(raw);
|
|
15390
16041
|
} catch {
|
|
15391
16042
|
throw new CliUsageError(
|
|
15392
|
-
`--${name} must be valid JSON for '${
|
|
15393
|
-
|
|
16043
|
+
`--${name} must be valid JSON for '${command2}'`,
|
|
16044
|
+
command2.split(" ")[0]
|
|
15394
16045
|
);
|
|
15395
16046
|
}
|
|
15396
16047
|
}
|
|
15397
|
-
function jsonSchemaStringFlag(flags,
|
|
16048
|
+
function jsonSchemaStringFlag(flags, command2, deps) {
|
|
15398
16049
|
const inlineSchema = flags["params-schema"];
|
|
15399
16050
|
const schemaFile = flags["params-schema-file"];
|
|
15400
16051
|
if (inlineSchema !== void 0 && schemaFile !== void 0) {
|
|
15401
16052
|
throw new CliUsageError(
|
|
15402
16053
|
"--params-schema and --params-schema-file are mutually exclusive",
|
|
15403
|
-
|
|
16054
|
+
command2.split(" ")[0]
|
|
15404
16055
|
);
|
|
15405
16056
|
}
|
|
15406
|
-
const raw = schemaFile !== void 0 ? readLocalTextFile(schemaFile,
|
|
16057
|
+
const raw = schemaFile !== void 0 ? readLocalTextFile(schemaFile, command2, "params-schema-file", deps) : inlineSchema;
|
|
15407
16058
|
if (raw === void 0) return void 0;
|
|
15408
16059
|
try {
|
|
15409
16060
|
JSON.parse(raw);
|
|
15410
16061
|
} catch {
|
|
15411
16062
|
const flag = schemaFile !== void 0 ? "params-schema-file" : "params-schema";
|
|
15412
16063
|
throw new CliUsageError(
|
|
15413
|
-
`--${flag} must contain valid JSON for '${
|
|
15414
|
-
|
|
16064
|
+
`--${flag} must contain valid JSON for '${command2}'`,
|
|
16065
|
+
command2.split(" ")[0]
|
|
15415
16066
|
);
|
|
15416
16067
|
}
|
|
15417
16068
|
return raw;
|
|
15418
16069
|
}
|
|
15419
|
-
function localFileUnsupported(
|
|
16070
|
+
function localFileUnsupported(command2, flag) {
|
|
15420
16071
|
return new CliUsageError(
|
|
15421
|
-
`--${flag} reads or writes a local file, which is unavailable in jagent. Use ALFS-native read/write/edit tools first, then pass ALFS paths or inline data to '${
|
|
15422
|
-
|
|
16072
|
+
`--${flag} reads or writes a local file, which is unavailable in jagent. Use ALFS-native read/write/edit tools first, then pass ALFS paths or inline data to '${command2}'.`,
|
|
16073
|
+
command2.split(" ")[0]
|
|
15423
16074
|
);
|
|
15424
16075
|
}
|
|
15425
|
-
function assertLocalFileAvailable(
|
|
16076
|
+
function assertLocalFileAvailable(command2, flag, deps) {
|
|
15426
16077
|
if (deps?.mode === "jagent") {
|
|
15427
|
-
throw localFileUnsupported(
|
|
16078
|
+
throw localFileUnsupported(command2, flag);
|
|
15428
16079
|
}
|
|
15429
16080
|
}
|
|
15430
|
-
function readLocalTextFile(path,
|
|
15431
|
-
assertLocalFileAvailable(
|
|
16081
|
+
function readLocalTextFile(path, command2, flag, deps) {
|
|
16082
|
+
assertLocalFileAvailable(command2, flag, deps);
|
|
15432
16083
|
return fs2.readFileSync(path, "utf-8");
|
|
15433
16084
|
}
|
|
15434
|
-
function readLocalFileBytes(path,
|
|
15435
|
-
assertLocalFileAvailable(
|
|
16085
|
+
function readLocalFileBytes(path, command2, flag, deps) {
|
|
16086
|
+
assertLocalFileAvailable(command2, flag, deps);
|
|
15436
16087
|
return fs2.readFileSync(path);
|
|
15437
16088
|
}
|
|
15438
16089
|
function sniffImageMime(bytes) {
|
|
@@ -15448,8 +16099,8 @@ function sniffImageMime(bytes) {
|
|
|
15448
16099
|
}
|
|
15449
16100
|
return "image/png";
|
|
15450
16101
|
}
|
|
15451
|
-
function writeLocalFileBytes(path, data,
|
|
15452
|
-
assertLocalFileAvailable(
|
|
16102
|
+
function writeLocalFileBytes(path, data, command2, flag, deps) {
|
|
16103
|
+
assertLocalFileAvailable(command2, flag, deps);
|
|
15453
16104
|
fs2.writeFileSync(path, data);
|
|
15454
16105
|
}
|
|
15455
16106
|
async function readAllStdin() {
|
|
@@ -15524,9 +16175,22 @@ async function dispatch(client, args, meta, deps) {
|
|
|
15524
16175
|
if (COMMAND_HELP[group] && (args[1] === "--help" || args[1] === "-h")) {
|
|
15525
16176
|
return { _help: true, text: COMMAND_HELP[group] };
|
|
15526
16177
|
}
|
|
16178
|
+
if (group === "broker") {
|
|
16179
|
+
return handleBroker(client, args.slice(1), deps);
|
|
16180
|
+
}
|
|
16181
|
+
const parsedCommand = parseCommand(args);
|
|
16182
|
+
const subcommand = parsedCommand.path[1];
|
|
16183
|
+
const flags = parsedCommand.flags;
|
|
16184
|
+
const positionals = parsedCommand.positionals;
|
|
16185
|
+
if (flags["help"] !== void 0) {
|
|
16186
|
+
const helpText = COMMAND_HELP[group];
|
|
16187
|
+
if (helpText) return { _help: true, text: helpText };
|
|
16188
|
+
}
|
|
15527
16189
|
if (group === "whoami") {
|
|
15528
16190
|
const user = await client.user.me();
|
|
15529
|
-
const record =
|
|
16191
|
+
const record = projectUserProfileForCLI(
|
|
16192
|
+
user
|
|
16193
|
+
);
|
|
15530
16194
|
const version = meta?.cliVersion ?? CLI_VERSION;
|
|
15531
16195
|
let arraysJwtStatus;
|
|
15532
16196
|
try {
|
|
@@ -15550,24 +16214,16 @@ async function dispatch(client, args, meta, deps) {
|
|
|
15550
16214
|
}
|
|
15551
16215
|
return result;
|
|
15552
16216
|
}
|
|
15553
|
-
if (group === "broker") {
|
|
15554
|
-
return handleBroker(client, args.slice(1), deps);
|
|
15555
|
-
}
|
|
15556
|
-
const subcommand = args[1];
|
|
15557
|
-
const flags = parseFlags2(
|
|
15558
|
-
args.slice(
|
|
15559
|
-
group === "run" || group === "remix" || group === "screenshot" ? 1 : 2
|
|
15560
|
-
)
|
|
15561
|
-
);
|
|
15562
|
-
if (flags["help"] !== void 0) {
|
|
15563
|
-
const helpText = COMMAND_HELP[group];
|
|
15564
|
-
if (helpText) return { _help: true, text: helpText };
|
|
15565
|
-
}
|
|
15566
16217
|
switch (group) {
|
|
15567
16218
|
case "user":
|
|
15568
16219
|
if (!subcommand)
|
|
15569
16220
|
throw new CliUsageError("Missing subcommand for user", "user");
|
|
15570
|
-
if (subcommand === "me")
|
|
16221
|
+
if (subcommand === "me") {
|
|
16222
|
+
const user = await client.user.me();
|
|
16223
|
+
return projectUserProfileForCLI(
|
|
16224
|
+
user
|
|
16225
|
+
);
|
|
16226
|
+
}
|
|
15571
16227
|
throw new CliUsageError(`Unknown subcommand: user ${subcommand}`, "user");
|
|
15572
16228
|
case "fs": {
|
|
15573
16229
|
if (!subcommand)
|
|
@@ -15712,6 +16368,13 @@ async function dispatch(client, args, meta, deps) {
|
|
|
15712
16368
|
1,
|
|
15713
16369
|
2046
|
|
15714
16370
|
),
|
|
16371
|
+
execution_timeout_seconds: optionalBoundedIntegerFlag(
|
|
16372
|
+
flags,
|
|
16373
|
+
"execution-timeout-seconds",
|
|
16374
|
+
"deploy create",
|
|
16375
|
+
1,
|
|
16376
|
+
3600
|
|
16377
|
+
),
|
|
15715
16378
|
run_as_user_id: optionalServiceAccountIdFlag(
|
|
15716
16379
|
flags,
|
|
15717
16380
|
"deploy create"
|
|
@@ -15740,6 +16403,13 @@ async function dispatch(client, args, meta, deps) {
|
|
|
15740
16403
|
1,
|
|
15741
16404
|
2046
|
|
15742
16405
|
),
|
|
16406
|
+
execution_timeout_seconds: optionalBoundedIntegerFlag(
|
|
16407
|
+
flags,
|
|
16408
|
+
"execution-timeout-seconds",
|
|
16409
|
+
"deploy update",
|
|
16410
|
+
1,
|
|
16411
|
+
3600
|
|
16412
|
+
),
|
|
15743
16413
|
run_as_user_id: resolveRunAsFlag(flags, "deploy update")
|
|
15744
16414
|
});
|
|
15745
16415
|
case "delete":
|
|
@@ -16074,7 +16744,7 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16074
16744
|
);
|
|
16075
16745
|
switch (subcommand) {
|
|
16076
16746
|
case "allowance": {
|
|
16077
|
-
const leaf =
|
|
16747
|
+
const leaf = parsedCommand.path[2];
|
|
16078
16748
|
if (!leaf || leaf === "--help" || leaf === "-h") {
|
|
16079
16749
|
return { _help: true, text: COMMAND_HELP.functions };
|
|
16080
16750
|
}
|
|
@@ -16251,13 +16921,7 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16251
16921
|
"lint"
|
|
16252
16922
|
);
|
|
16253
16923
|
}
|
|
16254
|
-
const file =
|
|
16255
|
-
if (!file || file.startsWith("--")) {
|
|
16256
|
-
throw new CliUsageError(
|
|
16257
|
-
"Missing file argument for lint playbook",
|
|
16258
|
-
"lint"
|
|
16259
|
-
);
|
|
16260
|
-
}
|
|
16924
|
+
const file = positionals[0];
|
|
16261
16925
|
const formatFlag = flags["format"];
|
|
16262
16926
|
if (formatFlag !== void 0 && formatFlag !== "human" && formatFlag !== "json") {
|
|
16263
16927
|
throw new CliUsageError(
|
|
@@ -16345,31 +17009,13 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16345
17009
|
return asJson ? result : formatSkillsList(result);
|
|
16346
17010
|
}
|
|
16347
17011
|
case "summary": {
|
|
16348
|
-
const name =
|
|
16349
|
-
if (!name || name.startsWith("--")) {
|
|
16350
|
-
throw new CliUsageError(
|
|
16351
|
-
"Missing skill name for data-skills summary",
|
|
16352
|
-
"data-skills"
|
|
16353
|
-
);
|
|
16354
|
-
}
|
|
17012
|
+
const name = positionals[0];
|
|
16355
17013
|
const result = await client.dataSkills.summary({ name });
|
|
16356
17014
|
return asJson ? result : formatSkillSummary(result);
|
|
16357
17015
|
}
|
|
16358
17016
|
case "endpoint": {
|
|
16359
|
-
const name =
|
|
16360
|
-
|
|
16361
|
-
throw new CliUsageError(
|
|
16362
|
-
"Missing skill name for data-skills endpoint",
|
|
16363
|
-
"data-skills"
|
|
16364
|
-
);
|
|
16365
|
-
}
|
|
16366
|
-
const file = args[3];
|
|
16367
|
-
if (!file || file.startsWith("--")) {
|
|
16368
|
-
throw new CliUsageError(
|
|
16369
|
-
"Missing endpoint file for data-skills endpoint",
|
|
16370
|
-
"data-skills"
|
|
16371
|
-
);
|
|
16372
|
-
}
|
|
17017
|
+
const name = positionals[0];
|
|
17018
|
+
const file = positionals[1];
|
|
16373
17019
|
const result = await client.dataSkills.endpoint({ name, file });
|
|
16374
17020
|
return asJson ? result : formatSkillEndpoint(result);
|
|
16375
17021
|
}
|
|
@@ -16397,31 +17043,13 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16397
17043
|
return asJson ? result : formatPlaybookSkillsTags(result);
|
|
16398
17044
|
}
|
|
16399
17045
|
case "get": {
|
|
16400
|
-
const id =
|
|
16401
|
-
if (!id || id.startsWith("--")) {
|
|
16402
|
-
throw new CliUsageError(
|
|
16403
|
-
"Missing playbook skill identifier for skillhub get",
|
|
16404
|
-
"skillhub"
|
|
16405
|
-
);
|
|
16406
|
-
}
|
|
17046
|
+
const id = positionals[0];
|
|
16407
17047
|
const result = await client.playbookSkills.get(id);
|
|
16408
17048
|
return asJson ? result : formatPlaybookSkillGet(result);
|
|
16409
17049
|
}
|
|
16410
17050
|
case "file": {
|
|
16411
|
-
const id =
|
|
16412
|
-
|
|
16413
|
-
throw new CliUsageError(
|
|
16414
|
-
"Missing playbook skill identifier for skillhub file",
|
|
16415
|
-
"skillhub"
|
|
16416
|
-
);
|
|
16417
|
-
}
|
|
16418
|
-
const path = args[3];
|
|
16419
|
-
if (!path || path.startsWith("--")) {
|
|
16420
|
-
throw new CliUsageError(
|
|
16421
|
-
"Missing file path for skillhub file",
|
|
16422
|
-
"skillhub"
|
|
16423
|
-
);
|
|
16424
|
-
}
|
|
17051
|
+
const id = positionals[0];
|
|
17052
|
+
const path = positionals[1];
|
|
16425
17053
|
const result = await client.playbookSkills.file(id, path);
|
|
16426
17054
|
return asJson ? result : formatPlaybookSkillFile(result);
|
|
16427
17055
|
}
|
|
@@ -16475,15 +17103,20 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16475
17103
|
`notification-history ${subcommand}`
|
|
16476
17104
|
),
|
|
16477
17105
|
name: requireFlag(flags, "name", `notification-history ${subcommand}`),
|
|
16478
|
-
channel:
|
|
17106
|
+
channel: deliveryProviderFilter(
|
|
17107
|
+
flags,
|
|
17108
|
+
`notification-history ${subcommand}`
|
|
17109
|
+
),
|
|
16479
17110
|
status: flags["status"],
|
|
16480
17111
|
since_time: num(flags["since"]),
|
|
16481
17112
|
first: num(flags["first"]),
|
|
16482
17113
|
cursor: flags["cursor"]
|
|
16483
17114
|
};
|
|
16484
17115
|
switch (subcommand) {
|
|
16485
|
-
case "list-feed":
|
|
16486
|
-
|
|
17116
|
+
case "list-feed": {
|
|
17117
|
+
const response = await client.notifications.listFeed(params);
|
|
17118
|
+
return projectNotificationHistoryForCLI(response);
|
|
17119
|
+
}
|
|
16487
17120
|
default:
|
|
16488
17121
|
throw new CliUsageError(
|
|
16489
17122
|
`Unknown subcommand: notification-history ${subcommand}`,
|
|
@@ -16672,8 +17305,14 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16672
17305
|
)
|
|
16673
17306
|
});
|
|
16674
17307
|
}
|
|
17308
|
+
const target = requireAutomationAlertTarget(flags, "alert enable");
|
|
17309
|
+
const channelId = flags["channel-id"] === void 0 ? void 0 : requirePositiveIntegerStringFlag(
|
|
17310
|
+
flags,
|
|
17311
|
+
"channel-id",
|
|
17312
|
+
"alert enable"
|
|
17313
|
+
);
|
|
16675
17314
|
return client.alerts.enableAutomation(
|
|
16676
|
-
|
|
17315
|
+
channelId === void 0 ? target : { ...target, channelId }
|
|
16677
17316
|
);
|
|
16678
17317
|
}
|
|
16679
17318
|
case "disable": {
|
|
@@ -16693,18 +17332,18 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16693
17332
|
);
|
|
16694
17333
|
}
|
|
16695
17334
|
case "group": {
|
|
16696
|
-
const leaf =
|
|
17335
|
+
const leaf = parsedCommand.path[2];
|
|
16697
17336
|
if (!leaf || leaf === "--help" || leaf === "-h") {
|
|
16698
17337
|
return { _help: true, text: COMMAND_HELP.alert };
|
|
16699
17338
|
}
|
|
16700
|
-
const
|
|
17339
|
+
const command2 = `alert group ${leaf}`;
|
|
16701
17340
|
if (flags["session-id"] !== void 0) {
|
|
16702
17341
|
throw new CliUsageError(
|
|
16703
|
-
`'${
|
|
17342
|
+
`'${command2}' uses the attached group and does not accept --session-id`,
|
|
16704
17343
|
"alert"
|
|
16705
17344
|
);
|
|
16706
17345
|
}
|
|
16707
|
-
const sessionID = requireCurrentGroupAlertSessionID(client,
|
|
17346
|
+
const sessionID = requireCurrentGroupAlertSessionID(client, command2);
|
|
16708
17347
|
switch (leaf) {
|
|
16709
17348
|
case "list": {
|
|
16710
17349
|
const result = await client.channelGroupSubscriptions.list({
|
|
@@ -16716,13 +17355,13 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16716
17355
|
return client.channelGroupSubscriptions.subscribe({
|
|
16717
17356
|
session_id: sessionID,
|
|
16718
17357
|
target_type: "feed",
|
|
16719
|
-
target_id: requireSingleGroupAlertFeedID(flags,
|
|
17358
|
+
target_id: requireSingleGroupAlertFeedID(flags, command2)
|
|
16720
17359
|
});
|
|
16721
17360
|
case "disable":
|
|
16722
17361
|
return client.channelGroupSubscriptions.unsubscribe({
|
|
16723
17362
|
session_id: sessionID,
|
|
16724
17363
|
target_type: "feed",
|
|
16725
|
-
target_id: requireSingleGroupAlertFeedID(flags,
|
|
17364
|
+
target_id: requireSingleGroupAlertFeedID(flags, command2)
|
|
16726
17365
|
});
|
|
16727
17366
|
default:
|
|
16728
17367
|
throw new CliUsageError(
|
|
@@ -16737,13 +17376,14 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16737
17376
|
const params = {
|
|
16738
17377
|
username: target.username,
|
|
16739
17378
|
name: target.name,
|
|
16740
|
-
channel: flags
|
|
17379
|
+
channel: deliveryProviderFilter(flags, "alert history"),
|
|
16741
17380
|
status: flags["status"],
|
|
16742
17381
|
since_time: num(flags["since"]),
|
|
16743
17382
|
first: num(flags["first"]),
|
|
16744
17383
|
cursor: flags["cursor"]
|
|
16745
17384
|
};
|
|
16746
|
-
|
|
17385
|
+
const response = await client.alerts.historyAutomation(params);
|
|
17386
|
+
return projectNotificationHistoryForCLI(response);
|
|
16747
17387
|
}
|
|
16748
17388
|
case "preferences":
|
|
16749
17389
|
return client.alerts.preferences();
|
|
@@ -16777,7 +17417,7 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16777
17417
|
return { _help: true, text: COMMAND_HELP.arrays };
|
|
16778
17418
|
}
|
|
16779
17419
|
if (subcommand === "token") {
|
|
16780
|
-
const leaf =
|
|
17420
|
+
const leaf = parsedCommand.path[2];
|
|
16781
17421
|
if (!leaf || leaf === "--help" || leaf === "-h") {
|
|
16782
17422
|
return { _help: true, text: COMMAND_HELP.arrays };
|
|
16783
17423
|
}
|
|
@@ -17017,8 +17657,8 @@ async function dispatch(client, args, meta, deps) {
|
|
|
17017
17657
|
}
|
|
17018
17658
|
}
|
|
17019
17659
|
case "auth": {
|
|
17020
|
-
const authSub =
|
|
17021
|
-
if (!authSub
|
|
17660
|
+
const authSub = parsedCommand.path[1];
|
|
17661
|
+
if (!authSub) {
|
|
17022
17662
|
return { _help: true, text: COMMAND_HELP.auth };
|
|
17023
17663
|
}
|
|
17024
17664
|
throw new CliUsageError(`Unknown auth subcommand: '${authSub}'`, "auth");
|
|
@@ -17028,12 +17668,6 @@ async function dispatch(client, args, meta, deps) {
|
|
|
17028
17668
|
}
|
|
17029
17669
|
}
|
|
17030
17670
|
function stripGlobalFlags(argv) {
|
|
17031
|
-
const GLOBAL_FLAGS = [
|
|
17032
|
-
"--api-key",
|
|
17033
|
-
"--base-url",
|
|
17034
|
-
"--profile",
|
|
17035
|
-
"--arrays-endpoint"
|
|
17036
|
-
];
|
|
17037
17671
|
const result = [];
|
|
17038
17672
|
for (let i = 0; i < argv.length; i++) {
|
|
17039
17673
|
const a = argv[i];
|
|
@@ -17041,11 +17675,15 @@ function stripGlobalFlags(argv) {
|
|
|
17041
17675
|
result.push(...argv.slice(i));
|
|
17042
17676
|
break;
|
|
17043
17677
|
}
|
|
17044
|
-
if (
|
|
17678
|
+
if (GLOBAL_VALUE_FLAG_SET.has(a)) {
|
|
17679
|
+
const value = argv[i + 1];
|
|
17680
|
+
if (value === void 0 || value.startsWith("--")) {
|
|
17681
|
+
throw new CliUsageError(`${a} requires a value`);
|
|
17682
|
+
}
|
|
17045
17683
|
i++;
|
|
17046
17684
|
continue;
|
|
17047
17685
|
}
|
|
17048
|
-
if (
|
|
17686
|
+
if (GLOBAL_VALUE_FLAGS.some((flag) => a.startsWith(`${flag}=`))) {
|
|
17049
17687
|
continue;
|
|
17050
17688
|
}
|
|
17051
17689
|
result.push(a);
|
|
@@ -17070,14 +17708,15 @@ async function main() {
|
|
|
17070
17708
|
return;
|
|
17071
17709
|
}
|
|
17072
17710
|
if (rawArgs[0] === "auth") {
|
|
17073
|
-
const
|
|
17074
|
-
|
|
17711
|
+
const parsedAuth = parseCommand(rawArgs);
|
|
17712
|
+
const authSub = parsedAuth.path[1];
|
|
17713
|
+
if (!authSub || parsedAuth.flags.help !== void 0) {
|
|
17075
17714
|
process.stdout.write(`${COMMAND_HELP.auth}
|
|
17076
17715
|
`);
|
|
17077
17716
|
return;
|
|
17078
17717
|
}
|
|
17079
17718
|
if (authSub === "login") {
|
|
17080
|
-
const loginFlags =
|
|
17719
|
+
const loginFlags = parsedAuth.flags;
|
|
17081
17720
|
const mode = selectMode(
|
|
17082
17721
|
process.env,
|
|
17083
17722
|
{
|
|
@@ -17187,7 +17826,7 @@ export {
|
|
|
17187
17826
|
dispatch,
|
|
17188
17827
|
handleConfigure,
|
|
17189
17828
|
isVersionOlderThan,
|
|
17190
|
-
|
|
17829
|
+
parseFlags,
|
|
17191
17830
|
stripGlobalFlags
|
|
17192
17831
|
};
|
|
17193
17832
|
/*! Bundled license information:
|