@ganakailabs/cloudeval-cli 0.29.4 → 0.30.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/dist/{App-33TDHYUP.js → App-FK5FKLOM.js} +6 -6
- package/dist/{Banner-QGOVG5CQ.js → Banner-XDSXKCKM.js} +2 -2
- package/dist/{Onboarding-HCORVZMZ.js → Onboarding-ZHKPXN5Z.js} +2 -2
- package/dist/{chunk-LEWFJSYP.js → chunk-C5GOTWYL.js} +1 -1
- package/dist/{chunk-XZIBSJA4.js → chunk-LWKMLKKE.js} +1 -1
- package/dist/{chunk-ERGQHMNT.js → chunk-NXM4JEOB.js} +108 -35
- package/dist/{chunk-4OE4CRKD.js → chunk-VRO5RWBC.js} +1 -1
- package/dist/cli.js +662 -349
- package/dist/{dist-QYIPN7MD.js → dist-6LEMVXIY.js} +3 -1
- package/dist/{resolveAskProject-CL25APSQ.js → resolveAskProject-XM4W4DON.js} +1 -1
- package/package.json +1 -1
- package/sbom.spdx.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -36,10 +36,10 @@ import {
|
|
|
36
36
|
redactSensitiveSecrets,
|
|
37
37
|
redactSensitiveText,
|
|
38
38
|
setActiveCLITraceContext
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-NXM4JEOB.js";
|
|
40
40
|
import {
|
|
41
41
|
CLI_VERSION
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-C5GOTWYL.js";
|
|
43
43
|
|
|
44
44
|
// src/runtime/prepareInk.ts
|
|
45
45
|
import fs from "fs";
|
|
@@ -416,6 +416,7 @@ var cliCommands = [
|
|
|
416
416
|
"--severity",
|
|
417
417
|
"--type",
|
|
418
418
|
"--timestamp",
|
|
419
|
+
"--report-verbosity",
|
|
419
420
|
"--region",
|
|
420
421
|
"--currency",
|
|
421
422
|
"--no-time-series",
|
|
@@ -851,7 +852,14 @@ var cliCommands = [
|
|
|
851
852
|
name: "login",
|
|
852
853
|
description: "Authenticate with CloudEval",
|
|
853
854
|
domain: "config",
|
|
854
|
-
options: [
|
|
855
|
+
options: [
|
|
856
|
+
"--base-url",
|
|
857
|
+
"--headless",
|
|
858
|
+
"--verbose",
|
|
859
|
+
"--profile",
|
|
860
|
+
"--show-sensitive-ids",
|
|
861
|
+
"--help"
|
|
862
|
+
],
|
|
855
863
|
workflows: ["login"]
|
|
856
864
|
},
|
|
857
865
|
{
|
|
@@ -865,7 +873,15 @@ var cliCommands = [
|
|
|
865
873
|
name: "auth",
|
|
866
874
|
description: "Authentication utilities",
|
|
867
875
|
domain: "config",
|
|
868
|
-
options: [
|
|
876
|
+
options: [
|
|
877
|
+
"status",
|
|
878
|
+
"--base-url",
|
|
879
|
+
"--format",
|
|
880
|
+
"--profile",
|
|
881
|
+
"--show-sensitive-ids",
|
|
882
|
+
"--verbose",
|
|
883
|
+
"--help"
|
|
884
|
+
],
|
|
869
885
|
workflows: ["auth status"]
|
|
870
886
|
},
|
|
871
887
|
{
|
|
@@ -984,14 +1000,29 @@ var cliCommands = [
|
|
|
984
1000
|
name: "doctor",
|
|
985
1001
|
description: "Diagnose local CLI configuration and environment",
|
|
986
1002
|
domain: "diagnostics",
|
|
987
|
-
options: [
|
|
1003
|
+
options: [
|
|
1004
|
+
"--base-url",
|
|
1005
|
+
"--format",
|
|
1006
|
+
"--deep",
|
|
1007
|
+
"--profile",
|
|
1008
|
+
"--show-sensitive-ids",
|
|
1009
|
+
"--verbose",
|
|
1010
|
+
"--help"
|
|
1011
|
+
],
|
|
988
1012
|
workflows: ["doctor"]
|
|
989
1013
|
},
|
|
990
1014
|
{
|
|
991
1015
|
name: "status",
|
|
992
1016
|
description: "Show CloudEval CLI status",
|
|
993
1017
|
domain: "diagnostics",
|
|
994
|
-
options: [
|
|
1018
|
+
options: [
|
|
1019
|
+
"--base-url",
|
|
1020
|
+
"--format",
|
|
1021
|
+
"--profile",
|
|
1022
|
+
"--show-sensitive-ids",
|
|
1023
|
+
"--verbose",
|
|
1024
|
+
"--help"
|
|
1025
|
+
],
|
|
995
1026
|
workflows: ["status"]
|
|
996
1027
|
},
|
|
997
1028
|
{
|
|
@@ -1680,7 +1711,7 @@ var resolveReportProjectId = async ({
|
|
|
1680
1711
|
if (!token) {
|
|
1681
1712
|
throw new Error("No project specified. Use --project <id> for report access.");
|
|
1682
1713
|
}
|
|
1683
|
-
const resolvedWorkspace = workspace ?? await import("./dist-
|
|
1714
|
+
const resolvedWorkspace = workspace ?? await import("./dist-6LEMVXIY.js").then((core) => ({
|
|
1684
1715
|
checkUserStatus: core.checkUserStatus,
|
|
1685
1716
|
getProjects: core.getProjects
|
|
1686
1717
|
}));
|
|
@@ -1709,7 +1740,7 @@ var warnIfAccessKeyFromCliOption = (options, command) => {
|
|
|
1709
1740
|
};
|
|
1710
1741
|
var resolveAuthContext = async (options, command, deps) => {
|
|
1711
1742
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
1712
|
-
const core = await import("./dist-
|
|
1743
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
1713
1744
|
core.assertSecureBaseUrl(baseUrl);
|
|
1714
1745
|
warnIfAccessKeyFromCliOption(options, command);
|
|
1715
1746
|
let accessKey = options.accessKey;
|
|
@@ -1767,12 +1798,28 @@ var addAuthOptions = (command, defaultBaseUrl) => command.option("--base-url <ur
|
|
|
1767
1798
|
).option("--access-key-stdin", "Read access key from stdin (recommended for automation)", false).option("--non-interactive", "Disable prompts and browser login", false);
|
|
1768
1799
|
|
|
1769
1800
|
// src/reports/reportCommand.tsx
|
|
1770
|
-
var outputFormats = [
|
|
1801
|
+
var outputFormats = [
|
|
1802
|
+
"tui",
|
|
1803
|
+
"summary",
|
|
1804
|
+
"text",
|
|
1805
|
+
"json",
|
|
1806
|
+
"ndjson",
|
|
1807
|
+
"markdown",
|
|
1808
|
+
"table"
|
|
1809
|
+
];
|
|
1771
1810
|
var addCommonOptions = (command, defaultBaseUrl) => command.option("--base-url <url>", "Backend base URL", defaultBaseUrl).option(
|
|
1772
1811
|
"--access-key <key>",
|
|
1773
1812
|
"Access key for automation",
|
|
1774
1813
|
process.env.CLOUDEVAL_ACCESS_KEY
|
|
1775
|
-
).option(
|
|
1814
|
+
).option(
|
|
1815
|
+
"--access-key-stdin",
|
|
1816
|
+
"Read access key from stdin (recommended for automation)",
|
|
1817
|
+
false
|
|
1818
|
+
).option("--project <id>", "Project ID to use").option("--format <format>", `Output format: ${outputFormats.join(", ")}`).option("--raw", "Show raw provider/backend payload", false).option("--parsed", "Show normalized parsed report payload", false).option("--formatted", "Show formatted human report payload", false).option("--output <file>", "Output file").option("--open", "Open the matching frontend report page", false).option("--print-url", "Print the matching frontend URL", false).option("--no-open", "Do not launch the browser when a URL is printed").option("--frontend-url <url>", "Frontend base URL").option(
|
|
1819
|
+
"--non-interactive",
|
|
1820
|
+
"Disable prompts and browser login",
|
|
1821
|
+
false
|
|
1822
|
+
);
|
|
1776
1823
|
var resolveMode = (options) => {
|
|
1777
1824
|
if (options.raw) return "raw";
|
|
1778
1825
|
if (options.parsed) return "parsed";
|
|
@@ -1783,7 +1830,9 @@ var resolveFormat = (requested, tuiDefault) => {
|
|
|
1783
1830
|
return requested;
|
|
1784
1831
|
}
|
|
1785
1832
|
if (requested) {
|
|
1786
|
-
throw new Error(
|
|
1833
|
+
throw new Error(
|
|
1834
|
+
`Unsupported format '${requested}'. Use ${outputFormats.join(", ")}.`
|
|
1835
|
+
);
|
|
1787
1836
|
}
|
|
1788
1837
|
return tuiDefault && process.stdout.isTTY && !process.env.CI ? "tui" : "summary";
|
|
1789
1838
|
};
|
|
@@ -1795,7 +1844,7 @@ var resolveToken = async (options, baseUrl, deps, command) => {
|
|
|
1795
1844
|
if (options.accessKey) {
|
|
1796
1845
|
return options.accessKey;
|
|
1797
1846
|
}
|
|
1798
|
-
const { getAuthToken } = await import("./dist-
|
|
1847
|
+
const { getAuthToken } = await import("./dist-6LEMVXIY.js");
|
|
1799
1848
|
try {
|
|
1800
1849
|
return await getAuthToken({
|
|
1801
1850
|
accessKey: options.accessKey,
|
|
@@ -1806,10 +1855,12 @@ var resolveToken = async (options, baseUrl, deps, command) => {
|
|
|
1806
1855
|
if (!canLogin) {
|
|
1807
1856
|
throw error;
|
|
1808
1857
|
}
|
|
1809
|
-
const { login } = await import("./dist-
|
|
1858
|
+
const { login } = await import("./dist-6LEMVXIY.js");
|
|
1810
1859
|
process.stderr.write("Authentication required. Starting login flow...\n");
|
|
1811
1860
|
const token = await login(baseUrl, {
|
|
1812
|
-
headless: Boolean(
|
|
1861
|
+
headless: Boolean(
|
|
1862
|
+
process.env.SSH_TTY || process.env.CLOUDEVAL_HEADLESS_LOGIN
|
|
1863
|
+
)
|
|
1813
1864
|
});
|
|
1814
1865
|
process.stderr.write("Authentication successful.\n");
|
|
1815
1866
|
return token;
|
|
@@ -1844,14 +1895,19 @@ var writeReport = async (report, options, tuiDefault) => {
|
|
|
1844
1895
|
import("ink"),
|
|
1845
1896
|
import("./ReportDashboard-DOAUB727.js")
|
|
1846
1897
|
]);
|
|
1847
|
-
render(
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1898
|
+
render(
|
|
1899
|
+
React2.createElement(ReportDashboard, {
|
|
1900
|
+
report,
|
|
1901
|
+
initialMode: mode === "formatted" ? "overview" : mode
|
|
1902
|
+
})
|
|
1903
|
+
);
|
|
1851
1904
|
return;
|
|
1852
1905
|
}
|
|
1853
1906
|
const textFormat = format === "text" || format === "table" ? "summary" : format;
|
|
1854
|
-
const text = serializeReportOutput(report, {
|
|
1907
|
+
const text = serializeReportOutput(report, {
|
|
1908
|
+
format: textFormat,
|
|
1909
|
+
mode
|
|
1910
|
+
});
|
|
1855
1911
|
if (options.output) {
|
|
1856
1912
|
const fs14 = await import("fs/promises");
|
|
1857
1913
|
await fs14.writeFile(options.output, text, "utf8");
|
|
@@ -1877,6 +1933,34 @@ var pickReportDownloadPayload = (value, view) => {
|
|
|
1877
1933
|
}
|
|
1878
1934
|
return value;
|
|
1879
1935
|
};
|
|
1936
|
+
var normalizeReportPdfVerbosity = (value) => {
|
|
1937
|
+
if (value === "brief" || value === "detailed" || value === "evidence") {
|
|
1938
|
+
return value;
|
|
1939
|
+
}
|
|
1940
|
+
if (value === "short") return "brief";
|
|
1941
|
+
if (value === "full" || value === "extended") return "evidence";
|
|
1942
|
+
return "detailed";
|
|
1943
|
+
};
|
|
1944
|
+
var mapReportTypeForPdf = (value) => {
|
|
1945
|
+
if (value === "cost") return "cost";
|
|
1946
|
+
if (value === "waf" || value === "architecture") return "architecture";
|
|
1947
|
+
if (value === "unit-tests" || value === "unit_tests") return "unit_tests";
|
|
1948
|
+
return "all";
|
|
1949
|
+
};
|
|
1950
|
+
var resolvePdfOutputPath = async (requestedOutput, filename) => {
|
|
1951
|
+
const path11 = await import("path");
|
|
1952
|
+
if (!requestedOutput) {
|
|
1953
|
+
return path11.resolve(filename);
|
|
1954
|
+
}
|
|
1955
|
+
const fs14 = await import("fs/promises");
|
|
1956
|
+
const stat = await fs14.stat(requestedOutput).catch(() => void 0);
|
|
1957
|
+
if (stat?.isDirectory() || !path11.extname(requestedOutput)) {
|
|
1958
|
+
await fs14.mkdir(requestedOutput, { recursive: true });
|
|
1959
|
+
return path11.join(requestedOutput, filename);
|
|
1960
|
+
}
|
|
1961
|
+
await fs14.mkdir(path11.dirname(requestedOutput), { recursive: true });
|
|
1962
|
+
return requestedOutput;
|
|
1963
|
+
};
|
|
1880
1964
|
var writeDownloadPayload = async (input) => {
|
|
1881
1965
|
if (!input.output) {
|
|
1882
1966
|
process.stdout.write(
|
|
@@ -1908,7 +1992,9 @@ var resolveMachineFormat = (requested) => {
|
|
|
1908
1992
|
if (requested === "text" || requested === "json" || requested === "ndjson" || requested === "markdown") {
|
|
1909
1993
|
return requested;
|
|
1910
1994
|
}
|
|
1911
|
-
throw new Error(
|
|
1995
|
+
throw new Error(
|
|
1996
|
+
"Unsupported format for reports run. Use text, json, ndjson, or markdown."
|
|
1997
|
+
);
|
|
1912
1998
|
};
|
|
1913
1999
|
var extractJobId = (value) => {
|
|
1914
2000
|
if (!value || typeof value !== "object") return void 0;
|
|
@@ -1917,8 +2003,17 @@ var extractJobId = (value) => {
|
|
|
1917
2003
|
};
|
|
1918
2004
|
var isTerminalJobStatus = (value) => {
|
|
1919
2005
|
if (!value || typeof value !== "object") return true;
|
|
1920
|
-
const status = String(
|
|
1921
|
-
|
|
2006
|
+
const status = String(
|
|
2007
|
+
value.status ?? ""
|
|
2008
|
+
).toLowerCase();
|
|
2009
|
+
return [
|
|
2010
|
+
"completed",
|
|
2011
|
+
"succeeded",
|
|
2012
|
+
"failed",
|
|
2013
|
+
"error",
|
|
2014
|
+
"cancelled",
|
|
2015
|
+
"canceled"
|
|
2016
|
+
].includes(status);
|
|
1922
2017
|
};
|
|
1923
2018
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1924
2019
|
var waitForReportJobs = async ({
|
|
@@ -1963,141 +2058,218 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
1963
2058
|
addCommonOptions(
|
|
1964
2059
|
reports.command("list").description("List available reports"),
|
|
1965
2060
|
deps.defaultBaseUrl
|
|
1966
|
-
).option("--kind <kind>", "Filter by kind: cost, waf, all", "all").action(
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2061
|
+
).option("--kind <kind>", "Filter by kind: cost, waf, all", "all").action(
|
|
2062
|
+
async (options, command) => {
|
|
2063
|
+
try {
|
|
2064
|
+
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
2065
|
+
const token = await resolveToken(options, baseUrl, deps, command);
|
|
2066
|
+
const projectId = await resolveReportProjectId({
|
|
2067
|
+
baseUrl,
|
|
2068
|
+
token,
|
|
2069
|
+
requestedProjectId: options.project
|
|
2070
|
+
});
|
|
2071
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2072
|
+
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2073
|
+
const reports2 = await core.listReports({
|
|
2074
|
+
baseUrl,
|
|
2075
|
+
authToken: token,
|
|
2076
|
+
projectId,
|
|
2077
|
+
kind: options.kind,
|
|
2078
|
+
userId: status?.user?.id
|
|
2079
|
+
});
|
|
2080
|
+
writeReportList(reports2, options.format);
|
|
2081
|
+
} catch (error) {
|
|
2082
|
+
console.error(
|
|
2083
|
+
`\u274C Failed to list reports: ${error?.message ?? "Unknown error"}`
|
|
2084
|
+
);
|
|
2085
|
+
process.exit(1);
|
|
2086
|
+
}
|
|
1988
2087
|
}
|
|
1989
|
-
|
|
2088
|
+
);
|
|
1990
2089
|
addCommonOptions(
|
|
1991
2090
|
reports.command("download").description("Download report JSON or markdown locally"),
|
|
1992
2091
|
deps.defaultBaseUrl
|
|
1993
|
-
).option(
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
const
|
|
2092
|
+
).option(
|
|
2093
|
+
"--type <type>",
|
|
2094
|
+
"Report type: cost, waf, architecture, unit-tests, all",
|
|
2095
|
+
"all"
|
|
2096
|
+
).option("--view <view>", "Payload view: raw, parsed, formatted", "raw").option("--timestamp <timestamp>", "Historical timestamp").option(
|
|
2097
|
+
"--report-verbosity <verbosity>",
|
|
2098
|
+
"PDF report depth: brief, detailed, evidence",
|
|
2099
|
+
"detailed"
|
|
2100
|
+
).action(
|
|
2101
|
+
async (options, command) => {
|
|
2102
|
+
try {
|
|
2103
|
+
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
2104
|
+
const token = await resolveToken(options, baseUrl, deps, command);
|
|
2105
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2106
|
+
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2107
|
+
const projectId = await resolveReportProjectId({
|
|
2108
|
+
baseUrl,
|
|
2109
|
+
token,
|
|
2110
|
+
requestedProjectId: options.project
|
|
2111
|
+
});
|
|
2112
|
+
if (options.format === "pdf") {
|
|
2113
|
+
if (options.timestamp) {
|
|
2114
|
+
throw new Error(
|
|
2115
|
+
"PDF download currently supports the latest report only."
|
|
2116
|
+
);
|
|
2117
|
+
}
|
|
2118
|
+
const verbosity = normalizeReportPdfVerbosity(
|
|
2119
|
+
options.reportVerbosity
|
|
2120
|
+
);
|
|
2121
|
+
const pdf = await core.downloadReportPdf({
|
|
2023
2122
|
baseUrl,
|
|
2024
2123
|
authToken: token,
|
|
2025
2124
|
projectId,
|
|
2026
2125
|
userId: status?.user?.id,
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
authToken: token,
|
|
2031
|
-
projectId,
|
|
2032
|
-
userId: status?.user?.id
|
|
2126
|
+
verbosity,
|
|
2127
|
+
reportType: mapReportTypeForPdf(options.type),
|
|
2128
|
+
includeVisuals: true
|
|
2033
2129
|
});
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
throw new Error(`Unsupported report type '${type}'.`);
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
const frontendUrl = frontendUrlForReports(
|
|
2040
|
-
baseUrl,
|
|
2041
|
-
{
|
|
2042
|
-
...options,
|
|
2043
|
-
tab: options.type === "cost" ? "cost" : options.type === "waf" ? "architecture" : "overview",
|
|
2044
|
-
reportType: options.type === "all" ? "all" : options.type
|
|
2045
|
-
},
|
|
2046
|
-
projectId
|
|
2047
|
-
);
|
|
2048
|
-
const data = reportTypes.length === 1 ? payload[reportTypes[0] === "architecture" ? "waf" : reportTypes[0]] : payload;
|
|
2049
|
-
if (options.output && reportTypes.length > 1) {
|
|
2050
|
-
const fs14 = await import("fs/promises");
|
|
2051
|
-
const path11 = await import("path");
|
|
2052
|
-
const stat = await fs14.stat(options.output).catch(() => void 0);
|
|
2053
|
-
if (stat?.isDirectory() || !path11.extname(options.output)) {
|
|
2054
|
-
await fs14.mkdir(options.output, { recursive: true });
|
|
2055
|
-
const files = [];
|
|
2056
|
-
for (const [key, value] of Object.entries(payload)) {
|
|
2057
|
-
const file = path11.join(options.output, `${projectId}-${key}-report.json`);
|
|
2058
|
-
files.push(
|
|
2059
|
-
...await writeDownloadPayload({
|
|
2060
|
-
command: "reports download",
|
|
2061
|
-
payload: value,
|
|
2062
|
-
format: "json",
|
|
2063
|
-
output: file,
|
|
2064
|
-
frontendUrl
|
|
2065
|
-
})
|
|
2066
|
-
);
|
|
2130
|
+
if (!pdf.bytes.length) {
|
|
2131
|
+
throw new Error("Backend returned an empty PDF.");
|
|
2067
2132
|
}
|
|
2133
|
+
const fs14 = await import("fs/promises");
|
|
2134
|
+
const outputPath = await resolvePdfOutputPath(
|
|
2135
|
+
options.output,
|
|
2136
|
+
pdf.filename
|
|
2137
|
+
);
|
|
2138
|
+
await fs14.writeFile(outputPath, pdf.bytes);
|
|
2068
2139
|
await writeFormattedOutput({
|
|
2069
2140
|
command: "reports download",
|
|
2070
|
-
data: {
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2141
|
+
data: {
|
|
2142
|
+
projectId,
|
|
2143
|
+
file: outputPath,
|
|
2144
|
+
format: "pdf",
|
|
2145
|
+
reportVerbosity: verbosity,
|
|
2146
|
+
status: pdf.status ?? "unknown",
|
|
2147
|
+
warningsCount: pdf.warningsCount ?? 0,
|
|
2148
|
+
bytes: pdf.bytes.length
|
|
2149
|
+
},
|
|
2150
|
+
format: "json",
|
|
2151
|
+
frontendUrl: frontendUrlForReports(baseUrl, options, projectId),
|
|
2152
|
+
filesWritten: [outputPath]
|
|
2074
2153
|
});
|
|
2075
|
-
await maybeOpenReportUrl(frontendUrl, options);
|
|
2076
2154
|
return;
|
|
2077
2155
|
}
|
|
2156
|
+
const reportTypes = options.type === "all" ? ["cost", "waf"] : [options.type || "cost"];
|
|
2157
|
+
const payload = {};
|
|
2158
|
+
for (const type of reportTypes) {
|
|
2159
|
+
if (type === "cost") {
|
|
2160
|
+
const data2 = options.timestamp ? await core.getCostReportHistory({
|
|
2161
|
+
baseUrl,
|
|
2162
|
+
authToken: token,
|
|
2163
|
+
projectId,
|
|
2164
|
+
userId: status?.user?.id,
|
|
2165
|
+
timestamp: options.timestamp
|
|
2166
|
+
}) : await core.getCostReportFull({
|
|
2167
|
+
baseUrl,
|
|
2168
|
+
authToken: token,
|
|
2169
|
+
projectId,
|
|
2170
|
+
userId: status?.user?.id
|
|
2171
|
+
});
|
|
2172
|
+
payload.cost = pickReportDownloadPayload(
|
|
2173
|
+
data2,
|
|
2174
|
+
options.view ?? "raw"
|
|
2175
|
+
);
|
|
2176
|
+
} else if (type === "waf" || type === "architecture") {
|
|
2177
|
+
const data2 = options.timestamp ? await core.getWafReportHistory({
|
|
2178
|
+
baseUrl,
|
|
2179
|
+
authToken: token,
|
|
2180
|
+
projectId,
|
|
2181
|
+
userId: status?.user?.id,
|
|
2182
|
+
timestamp: options.timestamp
|
|
2183
|
+
}) : await core.getWafReportFull({
|
|
2184
|
+
baseUrl,
|
|
2185
|
+
authToken: token,
|
|
2186
|
+
projectId,
|
|
2187
|
+
userId: status?.user?.id
|
|
2188
|
+
});
|
|
2189
|
+
payload.waf = pickReportDownloadPayload(
|
|
2190
|
+
data2,
|
|
2191
|
+
options.view ?? "raw"
|
|
2192
|
+
);
|
|
2193
|
+
} else {
|
|
2194
|
+
throw new Error(`Unsupported report type '${type}'.`);
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
const frontendUrl = frontendUrlForReports(
|
|
2198
|
+
baseUrl,
|
|
2199
|
+
{
|
|
2200
|
+
...options,
|
|
2201
|
+
tab: options.type === "cost" ? "cost" : options.type === "waf" ? "architecture" : "overview",
|
|
2202
|
+
reportType: options.type === "all" ? "all" : options.type
|
|
2203
|
+
},
|
|
2204
|
+
projectId
|
|
2205
|
+
);
|
|
2206
|
+
const data = reportTypes.length === 1 ? payload[reportTypes[0] === "architecture" ? "waf" : reportTypes[0]] : payload;
|
|
2207
|
+
if (options.output && reportTypes.length > 1) {
|
|
2208
|
+
const fs14 = await import("fs/promises");
|
|
2209
|
+
const path11 = await import("path");
|
|
2210
|
+
const stat = await fs14.stat(options.output).catch(() => void 0);
|
|
2211
|
+
if (stat?.isDirectory() || !path11.extname(options.output)) {
|
|
2212
|
+
await fs14.mkdir(options.output, { recursive: true });
|
|
2213
|
+
const files = [];
|
|
2214
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
2215
|
+
const file = path11.join(
|
|
2216
|
+
options.output,
|
|
2217
|
+
`${projectId}-${key}-report.json`
|
|
2218
|
+
);
|
|
2219
|
+
files.push(
|
|
2220
|
+
...await writeDownloadPayload({
|
|
2221
|
+
command: "reports download",
|
|
2222
|
+
payload: value,
|
|
2223
|
+
format: "json",
|
|
2224
|
+
output: file,
|
|
2225
|
+
frontendUrl
|
|
2226
|
+
})
|
|
2227
|
+
);
|
|
2228
|
+
}
|
|
2229
|
+
await writeFormattedOutput({
|
|
2230
|
+
command: "reports download",
|
|
2231
|
+
data: { projectId, filesWritten: files },
|
|
2232
|
+
format: options.format === "json" ? "json" : "text",
|
|
2233
|
+
frontendUrl,
|
|
2234
|
+
filesWritten: files
|
|
2235
|
+
});
|
|
2236
|
+
await maybeOpenReportUrl(frontendUrl, options);
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
await writeDownloadPayload({
|
|
2241
|
+
command: "reports download",
|
|
2242
|
+
payload: data,
|
|
2243
|
+
format: options.format === "markdown" ? "markdown" : "json",
|
|
2244
|
+
output: options.output,
|
|
2245
|
+
frontendUrl
|
|
2246
|
+
});
|
|
2247
|
+
await maybeOpenReportUrl(frontendUrl, options);
|
|
2248
|
+
} catch (error) {
|
|
2249
|
+
console.error(
|
|
2250
|
+
`Failed to download reports: ${error?.message ?? "Unknown error"}`
|
|
2251
|
+
);
|
|
2252
|
+
process.exit(1);
|
|
2078
2253
|
}
|
|
2079
|
-
await writeDownloadPayload({
|
|
2080
|
-
command: "reports download",
|
|
2081
|
-
payload: data,
|
|
2082
|
-
format: options.format === "markdown" ? "markdown" : "json",
|
|
2083
|
-
output: options.output,
|
|
2084
|
-
frontendUrl
|
|
2085
|
-
});
|
|
2086
|
-
await maybeOpenReportUrl(frontendUrl, options);
|
|
2087
|
-
} catch (error) {
|
|
2088
|
-
console.error(`Failed to download reports: ${error?.message ?? "Unknown error"}`);
|
|
2089
|
-
process.exit(1);
|
|
2090
2254
|
}
|
|
2091
|
-
|
|
2255
|
+
);
|
|
2092
2256
|
addCommonOptions(
|
|
2093
2257
|
reports.command("run").description("Run report generation for a project"),
|
|
2094
2258
|
deps.defaultBaseUrl
|
|
2095
|
-
).option(
|
|
2259
|
+
).option(
|
|
2260
|
+
"--type <type>",
|
|
2261
|
+
"Report type: cost, waf, architecture, unit-tests, all",
|
|
2262
|
+
"all"
|
|
2263
|
+
).option("--region <region>", "Cost report region", "eastus").option("--currency <currency>", "Cost report currency", "USD").option("--no-time-series", "Disable cost report time series generation").option("--no-save-report", "Do not persist generated report artifacts").option("--wait", "Poll submitted report jobs until terminal state", false).option(
|
|
2264
|
+
"--poll-interval <ms>",
|
|
2265
|
+
"Polling interval when --wait is set",
|
|
2266
|
+
"2500"
|
|
2267
|
+
).action(
|
|
2096
2268
|
async (options, command) => {
|
|
2097
2269
|
try {
|
|
2098
2270
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
2099
2271
|
const token = await resolveToken(options, baseUrl, deps, command);
|
|
2100
|
-
const core = await import("./dist-
|
|
2272
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2101
2273
|
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2102
2274
|
const projectId = await resolveReportProjectId({
|
|
2103
2275
|
baseUrl,
|
|
@@ -2114,8 +2286,10 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2114
2286
|
},
|
|
2115
2287
|
projectId
|
|
2116
2288
|
);
|
|
2117
|
-
process.stderr.write(
|
|
2118
|
-
`
|
|
2289
|
+
process.stderr.write(
|
|
2290
|
+
`Submitting ${requestedType} report run for project ${projectId}...
|
|
2291
|
+
`
|
|
2292
|
+
);
|
|
2119
2293
|
const submitted = await core.runReports({
|
|
2120
2294
|
baseUrl,
|
|
2121
2295
|
authToken: token,
|
|
@@ -2133,7 +2307,10 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2133
2307
|
token,
|
|
2134
2308
|
userId: status?.user?.id,
|
|
2135
2309
|
submitted,
|
|
2136
|
-
pollInterval: Math.max(
|
|
2310
|
+
pollInterval: Math.max(
|
|
2311
|
+
500,
|
|
2312
|
+
Number(options.pollInterval) || 2500
|
|
2313
|
+
)
|
|
2137
2314
|
}) : void 0;
|
|
2138
2315
|
await writeFormattedOutput({
|
|
2139
2316
|
command: "reports run",
|
|
@@ -2150,7 +2327,9 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2150
2327
|
});
|
|
2151
2328
|
await maybeOpenReportUrl(frontendUrl, options);
|
|
2152
2329
|
} catch (error) {
|
|
2153
|
-
console.error(
|
|
2330
|
+
console.error(
|
|
2331
|
+
`Failed to run reports: ${error?.message ?? "Unknown error"}`
|
|
2332
|
+
);
|
|
2154
2333
|
process.exit(1);
|
|
2155
2334
|
}
|
|
2156
2335
|
}
|
|
@@ -2158,42 +2337,46 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2158
2337
|
addCommonOptions(
|
|
2159
2338
|
reports.command("rules").description("Show Well-Architected Framework rules"),
|
|
2160
2339
|
deps.defaultBaseUrl
|
|
2161
|
-
).option("--type <type>", "Rule report type: waf", "waf").action(
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
token,
|
|
2168
|
-
requestedProjectId: options.project
|
|
2169
|
-
});
|
|
2170
|
-
const core = await import("./dist-QYIPN7MD.js");
|
|
2171
|
-
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2172
|
-
const report = await core.getWafReport({
|
|
2173
|
-
baseUrl,
|
|
2174
|
-
authToken: token,
|
|
2175
|
-
projectId,
|
|
2176
|
-
view: "rules",
|
|
2177
|
-
userId: status?.user?.id
|
|
2178
|
-
});
|
|
2179
|
-
const payload = selectReportModePayload(report, resolveMode(options));
|
|
2180
|
-
const rules = payload?.rules ?? report.parsed?.rules ?? report.raw?.rules ?? report.raw?.ruleResults ?? [];
|
|
2181
|
-
await writeFormattedOutput({
|
|
2182
|
-
command: "reports rules",
|
|
2183
|
-
data: rules,
|
|
2184
|
-
format: options.format === "json" || options.format === "ndjson" || options.format === "markdown" ? options.format : "text",
|
|
2185
|
-
output: options.output,
|
|
2186
|
-
frontendUrl: frontendUrlForReports(
|
|
2340
|
+
).option("--type <type>", "Rule report type: waf", "waf").action(
|
|
2341
|
+
async (options, command) => {
|
|
2342
|
+
try {
|
|
2343
|
+
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
2344
|
+
const token = await resolveToken(options, baseUrl, deps, command);
|
|
2345
|
+
const projectId = await resolveReportProjectId({
|
|
2187
2346
|
baseUrl,
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
)
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2347
|
+
token,
|
|
2348
|
+
requestedProjectId: options.project
|
|
2349
|
+
});
|
|
2350
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2351
|
+
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2352
|
+
const report = await core.getWafReport({
|
|
2353
|
+
baseUrl,
|
|
2354
|
+
authToken: token,
|
|
2355
|
+
projectId,
|
|
2356
|
+
view: "rules",
|
|
2357
|
+
userId: status?.user?.id
|
|
2358
|
+
});
|
|
2359
|
+
const payload = selectReportModePayload(report, resolveMode(options));
|
|
2360
|
+
const rules = payload?.rules ?? report.parsed?.rules ?? report.raw?.rules ?? report.raw?.ruleResults ?? [];
|
|
2361
|
+
await writeFormattedOutput({
|
|
2362
|
+
command: "reports rules",
|
|
2363
|
+
data: rules,
|
|
2364
|
+
format: options.format === "json" || options.format === "ndjson" || options.format === "markdown" ? options.format : "text",
|
|
2365
|
+
output: options.output,
|
|
2366
|
+
frontendUrl: frontendUrlForReports(
|
|
2367
|
+
baseUrl,
|
|
2368
|
+
{ ...options, tab: "architecture", reportType: "waf" },
|
|
2369
|
+
projectId
|
|
2370
|
+
)
|
|
2371
|
+
});
|
|
2372
|
+
} catch (error) {
|
|
2373
|
+
console.error(
|
|
2374
|
+
`Failed to show report rules: ${error?.message ?? "Unknown error"}`
|
|
2375
|
+
);
|
|
2376
|
+
process.exit(1);
|
|
2377
|
+
}
|
|
2195
2378
|
}
|
|
2196
|
-
|
|
2379
|
+
);
|
|
2197
2380
|
addCommonOptions(
|
|
2198
2381
|
reports.command("show").description("Show a report by id").argument("<report-id>", "Report ID"),
|
|
2199
2382
|
deps.defaultBaseUrl
|
|
@@ -2206,7 +2389,7 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2206
2389
|
token,
|
|
2207
2390
|
requestedProjectId: options.project
|
|
2208
2391
|
});
|
|
2209
|
-
const core = await import("./dist-
|
|
2392
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2210
2393
|
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2211
2394
|
const report = await core.getReport({
|
|
2212
2395
|
baseUrl,
|
|
@@ -2218,42 +2401,58 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2218
2401
|
});
|
|
2219
2402
|
await writeReport(report, options, false);
|
|
2220
2403
|
} catch (error) {
|
|
2221
|
-
console.error(
|
|
2404
|
+
console.error(
|
|
2405
|
+
`\u274C Failed to show report: ${error?.message ?? "Unknown error"}`
|
|
2406
|
+
);
|
|
2222
2407
|
process.exit(1);
|
|
2223
2408
|
}
|
|
2224
2409
|
});
|
|
2225
2410
|
addCommonOptions(
|
|
2226
2411
|
reports.command("cost").description("Show the latest cost report"),
|
|
2227
2412
|
deps.defaultBaseUrl
|
|
2228
|
-
).option(
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2413
|
+
).option(
|
|
2414
|
+
"--period <period>",
|
|
2415
|
+
"Report period, for example 7d, 30d, 90d",
|
|
2416
|
+
"30d"
|
|
2417
|
+
).option(
|
|
2418
|
+
"--view <view>",
|
|
2419
|
+
"Cost view: overview, services, recommendations, anomalies, raw"
|
|
2420
|
+
).action(
|
|
2421
|
+
async (options, command) => {
|
|
2422
|
+
try {
|
|
2423
|
+
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
2424
|
+
const token = await resolveToken(options, baseUrl, deps, command);
|
|
2425
|
+
const projectId = await resolveReportProjectId({
|
|
2426
|
+
baseUrl,
|
|
2427
|
+
token,
|
|
2428
|
+
requestedProjectId: options.project
|
|
2429
|
+
});
|
|
2430
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2431
|
+
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2432
|
+
const report = await core.getCostReport({
|
|
2433
|
+
baseUrl,
|
|
2434
|
+
authToken: token,
|
|
2435
|
+
projectId,
|
|
2436
|
+
period: options.period,
|
|
2437
|
+
view: options.view,
|
|
2438
|
+
userId: status?.user?.id
|
|
2439
|
+
});
|
|
2440
|
+
await writeReport(report, options, true);
|
|
2441
|
+
} catch (error) {
|
|
2442
|
+
console.error(
|
|
2443
|
+
`\u274C Failed to show cost report: ${error?.message ?? "Unknown error"}`
|
|
2444
|
+
);
|
|
2445
|
+
process.exit(1);
|
|
2446
|
+
}
|
|
2251
2447
|
}
|
|
2252
|
-
|
|
2448
|
+
);
|
|
2253
2449
|
addCommonOptions(
|
|
2254
2450
|
reports.command("waf").description("Show the latest Well-Architected Framework report"),
|
|
2255
2451
|
deps.defaultBaseUrl
|
|
2256
|
-
).option("--report <id>", "Specific report id").option("--severity <severity>", "Filter by severity").option(
|
|
2452
|
+
).option("--report <id>", "Specific report id").option("--severity <severity>", "Filter by severity").option(
|
|
2453
|
+
"--view <view>",
|
|
2454
|
+
"WAF view: overview, pillars, rules, resources, raw"
|
|
2455
|
+
).action(
|
|
2257
2456
|
async (options, command) => {
|
|
2258
2457
|
try {
|
|
2259
2458
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
@@ -2263,7 +2462,7 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2263
2462
|
token,
|
|
2264
2463
|
requestedProjectId: options.project
|
|
2265
2464
|
});
|
|
2266
|
-
const core = await import("./dist-
|
|
2465
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2267
2466
|
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2268
2467
|
const report = await core.getWafReport({
|
|
2269
2468
|
baseUrl,
|
|
@@ -2276,7 +2475,9 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2276
2475
|
});
|
|
2277
2476
|
await writeReport(report, options, true);
|
|
2278
2477
|
} catch (error) {
|
|
2279
|
-
console.error(
|
|
2478
|
+
console.error(
|
|
2479
|
+
`\u274C Failed to show WAF report: ${error?.message ?? "Unknown error"}`
|
|
2480
|
+
);
|
|
2280
2481
|
process.exit(1);
|
|
2281
2482
|
}
|
|
2282
2483
|
}
|
|
@@ -5269,7 +5470,7 @@ var runChatRecipe = async (recipe, prompt2, options, command, deps) => {
|
|
|
5269
5470
|
});
|
|
5270
5471
|
progressWriter.write({ type: "auth", step: "auth", message: "Resolving authentication" });
|
|
5271
5472
|
const context = await resolveAuthContext(options, command, deps);
|
|
5272
|
-
const core = await import("./dist-
|
|
5473
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
5273
5474
|
progressWriter.write({
|
|
5274
5475
|
type: "request",
|
|
5275
5476
|
step: "project",
|
|
@@ -6833,7 +7034,7 @@ var configureDiagramExportCommand = (command, deps) => addAuthOptions(command, d
|
|
|
6833
7034
|
const context = requireAuthUser(
|
|
6834
7035
|
await resolveAuthContext(options, actionCommand, deps)
|
|
6835
7036
|
);
|
|
6836
|
-
const core = await import("./dist-
|
|
7037
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
6837
7038
|
const projects = await core.getProjects(
|
|
6838
7039
|
context.baseUrl,
|
|
6839
7040
|
context.token,
|
|
@@ -6910,7 +7111,7 @@ var registerProjectsCommand = (program2, deps) => {
|
|
|
6910
7111
|
addCommon(addAuthOptions(projects.command("list").description("List projects"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
6911
7112
|
try {
|
|
6912
7113
|
const context = await resolveAuthContext(options, command, deps);
|
|
6913
|
-
const core = await import("./dist-
|
|
7114
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
6914
7115
|
const data = await listProjectsForContext(core, context);
|
|
6915
7116
|
const url = buildFrontendUrl({ baseUrl: frontendBase(context, options), target: "projects" });
|
|
6916
7117
|
await writeProjectListOutput({ data, options, frontendUrl: url });
|
|
@@ -6928,7 +7129,7 @@ var registerProjectsCommand = (program2, deps) => {
|
|
|
6928
7129
|
).action(async (id, options, command) => {
|
|
6929
7130
|
try {
|
|
6930
7131
|
const context = await resolveAuthContext(options, command, deps);
|
|
6931
|
-
const core = await import("./dist-
|
|
7132
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
6932
7133
|
const list = await listProjectsForContext(core, context);
|
|
6933
7134
|
const data = list.find((project) => project.id === id);
|
|
6934
7135
|
if (!data) {
|
|
@@ -6997,7 +7198,7 @@ var registerProjectsCommand = (program2, deps) => {
|
|
|
6997
7198
|
try {
|
|
6998
7199
|
assertSingleProjectSource(options);
|
|
6999
7200
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7000
|
-
const core = await import("./dist-
|
|
7201
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7001
7202
|
const template = await fileBlob(options.templateFile);
|
|
7002
7203
|
const parameters = await fileBlob(options.parametersFile);
|
|
7003
7204
|
const workspace = options.workspaceDir ? await collectWorkspaceFiles(options.workspaceDir, options) : void 0;
|
|
@@ -7122,7 +7323,7 @@ var registerIssuesInventoryCommand = (program2, deps) => {
|
|
|
7122
7323
|
addCommon2(addAuthOptions(inventory.command("list").description("List issues inventory items"), deps.defaultBaseUrl)).option("--project <id>", "Filter by project id").option("--type <types>", "Filter by type: architecture,cost,unit-tests").option("--severity <levels>", "Filter by severity: critical,high,medium,low").option("--pillar <pillars>", "Filter by pillar").option("--category <categories>", "Filter by category").option("--resource-type <types>", "Filter by resource type").option("--q <query>", "Search query").option("--min-monthly-savings <amount>", "Minimum monthly savings for cost items").option("--sort <sort>", "Sort: priority, severity, savings, project", "priority").option("--limit <n>", "Page size (1-500)", "50").option("--offset <n>", "Page offset", "0").option("--allow-full-scan", "Allow scanning large portfolios without project filter", true).option("--no-allow-full-scan", "Require project scoping for large portfolios").action(async (options, command) => {
|
|
7123
7324
|
try {
|
|
7124
7325
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7125
|
-
const core = await import("./dist-
|
|
7326
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7126
7327
|
const data = await core.listIssuesItems({
|
|
7127
7328
|
baseUrl: context.baseUrl,
|
|
7128
7329
|
authToken: context.token,
|
|
@@ -7170,7 +7371,7 @@ var registerIssuesInventoryCommand = (program2, deps) => {
|
|
|
7170
7371
|
addCommon2(addAuthOptions(inventory.command("get <item-id>").description("Get one issues inventory item"), deps.defaultBaseUrl)).option("--project <id>", "Optional project scope").option("--allow-full-scan", "Allow scanning large portfolios", true).option("--no-allow-full-scan", "Require project scoping for large portfolios").action(async (itemId, options, command) => {
|
|
7171
7372
|
try {
|
|
7172
7373
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7173
|
-
const core = await import("./dist-
|
|
7374
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7174
7375
|
const data = await core.getIssuesItem({
|
|
7175
7376
|
baseUrl: context.baseUrl,
|
|
7176
7377
|
authToken: context.token,
|
|
@@ -7291,7 +7492,7 @@ var registerConnectionsCommand = (program2, deps) => {
|
|
|
7291
7492
|
addCommon3(addAuthOptions(connections.command("list").description("List connections"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
7292
7493
|
try {
|
|
7293
7494
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7294
|
-
const core = await import("./dist-
|
|
7495
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7295
7496
|
const data = await core.listConnections({
|
|
7296
7497
|
baseUrl: context.baseUrl,
|
|
7297
7498
|
authToken: context.token,
|
|
@@ -7316,7 +7517,7 @@ var registerConnectionsCommand = (program2, deps) => {
|
|
|
7316
7517
|
).action(async (id, options, command) => {
|
|
7317
7518
|
try {
|
|
7318
7519
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7319
|
-
const core = await import("./dist-
|
|
7520
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7320
7521
|
const data = await core.getConnection({
|
|
7321
7522
|
baseUrl: context.baseUrl,
|
|
7322
7523
|
authToken: context.token,
|
|
@@ -7653,7 +7854,7 @@ var checkoutReturnUrl = (context, options) => options.returnTo || billingUrl(con
|
|
|
7653
7854
|
var runTopUpCheckout = async (commandName, packId, options, command, deps) => {
|
|
7654
7855
|
try {
|
|
7655
7856
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7656
|
-
const core = await import("./dist-
|
|
7857
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7657
7858
|
const returnTo = checkoutReturnUrl(context, options);
|
|
7658
7859
|
const session = await core.createTopUpCheckoutSession({
|
|
7659
7860
|
baseUrl: context.baseUrl,
|
|
@@ -7693,7 +7894,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7693
7894
|
).action(async (options, command) => {
|
|
7694
7895
|
try {
|
|
7695
7896
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7696
|
-
const core = await import("./dist-
|
|
7897
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7697
7898
|
const range = rangeToDates("30d");
|
|
7698
7899
|
const [entitlement, usageSummary] = await Promise.all([
|
|
7699
7900
|
core.getBillingEntitlement({
|
|
@@ -7723,7 +7924,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7723
7924
|
addCommon4(addAuthOptions(billing.command("summary").description("Show billing summary"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
7724
7925
|
try {
|
|
7725
7926
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7726
|
-
const core = await import("./dist-
|
|
7927
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7727
7928
|
const range = rangeToDates("30d");
|
|
7728
7929
|
const [entitlement, subscriptionStatus, usageSummary] = await Promise.all([
|
|
7729
7930
|
core.getBillingEntitlement({ baseUrl: context.baseUrl, authToken: context.token }),
|
|
@@ -7759,7 +7960,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7759
7960
|
addCommon4(addAuthOptions(billing.command("plans").description("Show billing plans"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
7760
7961
|
try {
|
|
7761
7962
|
const context = await resolveAuthContext(options, command, deps);
|
|
7762
|
-
const core = await import("./dist-
|
|
7963
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7763
7964
|
const data = await core.getBillingConfig({ baseUrl: context.baseUrl, authToken: context.token });
|
|
7764
7965
|
const url = billingUrl(context, { ...options, tab: "plans" });
|
|
7765
7966
|
await write("billing plans", data, options, url);
|
|
@@ -7771,7 +7972,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7771
7972
|
addCommon4(addAuthOptions(billing.command("usage").description("Show billing usage summary"), deps.defaultBaseUrl)).option("--range <range>", "Usage range: 7d, 30d, 90d, all", "30d").option("--start-at <iso>", "Start timestamp").option("--end-at <iso>", "End timestamp").option("--granularity <value>", "Granularity: hour, day, month", "day").option("--action-type <type>", "Action type filter").option("--model <name>", "Model filter").option("--outcome <outcome>", "Outcome filter").option("--charge-status <status>", "Charge status filter").action(async (options, command) => {
|
|
7772
7973
|
try {
|
|
7773
7974
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7774
|
-
const core = await import("./dist-
|
|
7975
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7775
7976
|
const range = rangeToDates(options.range);
|
|
7776
7977
|
const data = await core.getBillingUsageSummary({
|
|
7777
7978
|
baseUrl: context.baseUrl,
|
|
@@ -7794,7 +7995,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7794
7995
|
addCommon4(addAuthOptions(billing.command("ledger").description("Show billing ledger"), deps.defaultBaseUrl)).option("--range <range>", "Usage range: 7d, 30d, 90d, all", "30d").option("--start-at <iso>", "Start timestamp").option("--end-at <iso>", "End timestamp").option("--action-type <type>", "Action type filter").option("--model <name>", "Model filter").option("--outcome <outcome>", "Outcome filter").option("--charge-status <status>", "Charge status filter").option("--limit <n>", "Page size", "25").option("--cursor <cursor>", "Pagination cursor").action(async (options, command) => {
|
|
7795
7996
|
try {
|
|
7796
7997
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7797
|
-
const core = await import("./dist-
|
|
7998
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7798
7999
|
const range = rangeToDates(options.range);
|
|
7799
8000
|
const data = await core.getBillingUsageLedger({
|
|
7800
8001
|
baseUrl: context.baseUrl,
|
|
@@ -7822,7 +8023,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7822
8023
|
addCommon4(addAuthOptions(billing.command(name).description(`Show billing ${name}`), deps.defaultBaseUrl)).option("--limit <n>", "Result limit", "25").action(async (options, command) => {
|
|
7823
8024
|
try {
|
|
7824
8025
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7825
|
-
const core = await import("./dist-
|
|
8026
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7826
8027
|
const data = await core[getter]({
|
|
7827
8028
|
baseUrl: context.baseUrl,
|
|
7828
8029
|
authToken: context.token,
|
|
@@ -7840,7 +8041,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7840
8041
|
addCommon4(addAuthOptions(topups, deps.defaultBaseUrl)).option("--limit <n>", "Result limit", "25").action(async (options, command) => {
|
|
7841
8042
|
try {
|
|
7842
8043
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7843
|
-
const core = await import("./dist-
|
|
8044
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7844
8045
|
const data = await core.getTopUpPacks({
|
|
7845
8046
|
baseUrl: context.baseUrl,
|
|
7846
8047
|
authToken: context.token
|
|
@@ -10895,7 +11096,7 @@ var reportsFrontendUrl = (config, input) => buildFrontendUrl({
|
|
|
10895
11096
|
reportVerbosity: input.reportVerbosity
|
|
10896
11097
|
});
|
|
10897
11098
|
var resolveAuth = async (config, options = {}) => {
|
|
10898
|
-
const core = await import("./dist-
|
|
11099
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
10899
11100
|
core.assertSecureBaseUrl(config.baseUrl);
|
|
10900
11101
|
let token;
|
|
10901
11102
|
try {
|
|
@@ -10991,7 +11192,7 @@ var assertModelAvailable = async (config, token) => {
|
|
|
10991
11192
|
if (!config.model) {
|
|
10992
11193
|
return;
|
|
10993
11194
|
}
|
|
10994
|
-
const core = await import("./dist-
|
|
11195
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
10995
11196
|
try {
|
|
10996
11197
|
const response = await fetch(
|
|
10997
11198
|
`${core.normalizeApiBase(config.baseUrl)}/models`,
|
|
@@ -11248,7 +11449,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11248
11449
|
});
|
|
11249
11450
|
handlers.set("agent_profiles_list", async (args) => {
|
|
11250
11451
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11251
|
-
const core = await import("./dist-
|
|
11452
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11252
11453
|
const data = await listProfilesForDiscovery(core, config.baseUrl);
|
|
11253
11454
|
return withEnvelope({
|
|
11254
11455
|
command: "agents list",
|
|
@@ -11261,7 +11462,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11261
11462
|
throw new Error("profileId is required.");
|
|
11262
11463
|
}
|
|
11263
11464
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11264
|
-
const core = await import("./dist-
|
|
11465
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11265
11466
|
const data = await getProfileForDiscovery(core, config.baseUrl, profileId);
|
|
11266
11467
|
return withEnvelope({
|
|
11267
11468
|
command: "agents show",
|
|
@@ -11907,7 +12108,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11907
12108
|
});
|
|
11908
12109
|
handlers.set("auth_status", async (args) => {
|
|
11909
12110
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11910
|
-
const core = await import("./dist-
|
|
12111
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11911
12112
|
const data = await core.getAuthStatus(config.baseUrl, { validate: true });
|
|
11912
12113
|
return withEnvelope({
|
|
11913
12114
|
command: "auth status",
|
|
@@ -11916,7 +12117,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11916
12117
|
});
|
|
11917
12118
|
handlers.set("status", async (args) => {
|
|
11918
12119
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11919
|
-
const core = await import("./dist-
|
|
12120
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11920
12121
|
const auth = await core.getAuthStatus(config.baseUrl, { validate: true });
|
|
11921
12122
|
return withEnvelope({
|
|
11922
12123
|
command: "status",
|
|
@@ -11947,7 +12148,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11947
12148
|
}
|
|
11948
12149
|
];
|
|
11949
12150
|
try {
|
|
11950
|
-
const core = await import("./dist-
|
|
12151
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11951
12152
|
core.assertSecureBaseUrl(config.baseUrl);
|
|
11952
12153
|
checks.push({
|
|
11953
12154
|
id: "base-url-secure",
|
|
@@ -12467,7 +12668,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
12467
12668
|
} catch {
|
|
12468
12669
|
token = config.accessKey;
|
|
12469
12670
|
}
|
|
12470
|
-
const core = await import("./dist-
|
|
12671
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
12471
12672
|
const data = await core.getBillingConfig({
|
|
12472
12673
|
baseUrl: config.baseUrl,
|
|
12473
12674
|
authToken: token
|
|
@@ -13363,7 +13564,7 @@ var registerCapabilitiesCommand = (program2, deps) => {
|
|
|
13363
13564
|
warnIfAccessKeyFromCliOption(options, command);
|
|
13364
13565
|
let data = capabilities;
|
|
13365
13566
|
if (options.live) {
|
|
13366
|
-
const core = await import("./dist-
|
|
13567
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13367
13568
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
13368
13569
|
const accessKey = options.accessKeyStdin ? await deps.readStdinValue() : options.accessKey;
|
|
13369
13570
|
const token = await core.getAuthToken({ accessKey, baseUrl });
|
|
@@ -13501,7 +13702,7 @@ var writeCredentialOutput = async (input) => {
|
|
|
13501
13702
|
};
|
|
13502
13703
|
var resolveCoreAuth = async (options, command, deps) => {
|
|
13503
13704
|
const context = await resolveAuthContext(options, command, deps);
|
|
13504
|
-
const core = await import("./dist-
|
|
13705
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13505
13706
|
return { ...context, core };
|
|
13506
13707
|
};
|
|
13507
13708
|
var parseCapabilities = (value) => value?.split(",").map((item) => item.trim()).filter(Boolean);
|
|
@@ -13834,7 +14035,7 @@ var registerAgentsCommand = (program2, deps) => {
|
|
|
13834
14035
|
const agents = program2.command("agents").description("CloudEval Agent Profile utilities");
|
|
13835
14036
|
addAgentOutputOptions(agents.command("list").description("List Agent Profiles"), deps).action(async (options, command) => {
|
|
13836
14037
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
13837
|
-
const core = await import("./dist-
|
|
14038
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13838
14039
|
core.assertSecureBaseUrl(baseUrl);
|
|
13839
14040
|
const data = await listProfilesForDiscovery2(core, baseUrl);
|
|
13840
14041
|
await writeProfiles({
|
|
@@ -13850,7 +14051,7 @@ var registerAgentsCommand = (program2, deps) => {
|
|
|
13850
14051
|
deps
|
|
13851
14052
|
).action(async (profileId, options, command) => {
|
|
13852
14053
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
13853
|
-
const core = await import("./dist-
|
|
14054
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13854
14055
|
core.assertSecureBaseUrl(baseUrl);
|
|
13855
14056
|
const data = await getProfileForDiscovery2(core, baseUrl, profileId);
|
|
13856
14057
|
await writeProfiles({
|
|
@@ -13869,7 +14070,7 @@ var registerAgentsCommand = (program2, deps) => {
|
|
|
13869
14070
|
const cliProfile = getActiveConfigProfile(command);
|
|
13870
14071
|
const cliConfig = await loadCliConfig(cliProfile);
|
|
13871
14072
|
const auth = await resolveAuthContext(options, command, deps);
|
|
13872
|
-
const core = await import("./dist-
|
|
14073
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13873
14074
|
const profileResponse = await core.getAgentProfile({
|
|
13874
14075
|
baseUrl: auth.baseUrl,
|
|
13875
14076
|
authToken: auth.token,
|
|
@@ -14431,7 +14632,7 @@ var registerDiagnosticsCommands = (program2, deps) => {
|
|
|
14431
14632
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
14432
14633
|
const profile = getActiveConfigProfile(command);
|
|
14433
14634
|
const config = await loadCliConfig(profile);
|
|
14434
|
-
const core = await import("./dist-
|
|
14635
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14435
14636
|
const auth = await core.getAuthStatus(baseUrl, { validate: true });
|
|
14436
14637
|
if (options.format === "text" || !options.format) {
|
|
14437
14638
|
process.stdout.write(
|
|
@@ -14481,7 +14682,7 @@ var registerDiagnosticsCommands = (program2, deps) => {
|
|
|
14481
14682
|
detail: getCliConfigPath(profile)
|
|
14482
14683
|
});
|
|
14483
14684
|
try {
|
|
14484
|
-
const core = await import("./dist-
|
|
14685
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14485
14686
|
core.assertSecureBaseUrl(baseUrl);
|
|
14486
14687
|
checks.push({
|
|
14487
14688
|
id: "base-url-secure",
|
|
@@ -14581,7 +14782,7 @@ var resolveToken2 = async (options, deps, baseUrl, command) => {
|
|
|
14581
14782
|
return options.accessKey;
|
|
14582
14783
|
}
|
|
14583
14784
|
try {
|
|
14584
|
-
const core = await import("./dist-
|
|
14785
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14585
14786
|
return await core.getAuthToken({
|
|
14586
14787
|
baseUrl
|
|
14587
14788
|
});
|
|
@@ -14665,7 +14866,7 @@ var registerModelsCommand = (program2, deps) => {
|
|
|
14665
14866
|
let source = "fallback";
|
|
14666
14867
|
let modelList = fallbackModels;
|
|
14667
14868
|
try {
|
|
14668
|
-
const core = await import("./dist-
|
|
14869
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14669
14870
|
const response = await fetch(`${core.normalizeApiBase(baseUrl)}/models`, {
|
|
14670
14871
|
headers: {
|
|
14671
14872
|
Accept: "application/json",
|
|
@@ -15786,9 +15987,13 @@ var enableCliDebugLogging = () => {
|
|
|
15786
15987
|
process.env.CLOUDEVAL_CLI_DEBUG = "1";
|
|
15787
15988
|
};
|
|
15788
15989
|
var redactSensitive = (value) => redactSensitiveSecrets(value);
|
|
15789
|
-
var isHeadlessEnvironment = () => Boolean(
|
|
15990
|
+
var isHeadlessEnvironment = () => Boolean(
|
|
15991
|
+
process.env.SSH_TTY || process.env.CI || process.env.CLOUDEVAL_HEADLESS_LOGIN
|
|
15992
|
+
);
|
|
15790
15993
|
var assertNoLegacyApiKeyUsage = () => {
|
|
15791
|
-
const legacyArg = process.argv.slice(2).some(
|
|
15994
|
+
const legacyArg = process.argv.slice(2).some(
|
|
15995
|
+
(arg) => arg === "--api-key" || arg === "--api-key-stdin" || arg.startsWith("--api-key=")
|
|
15996
|
+
);
|
|
15792
15997
|
if (legacyArg || process.env.CLOUDEVAL_API_KEY) {
|
|
15793
15998
|
process.stderr.write(`${LEGACY_API_KEY_MESSAGE}
|
|
15794
15999
|
`);
|
|
@@ -15800,13 +16005,31 @@ var completionScriptPath = (shell) => {
|
|
|
15800
16005
|
const home = os6.homedir();
|
|
15801
16006
|
switch (shell) {
|
|
15802
16007
|
case "bash":
|
|
15803
|
-
return path10.join(
|
|
16008
|
+
return path10.join(
|
|
16009
|
+
home,
|
|
16010
|
+
".local",
|
|
16011
|
+
"share",
|
|
16012
|
+
"bash-completion",
|
|
16013
|
+
"completions",
|
|
16014
|
+
"cloudeval"
|
|
16015
|
+
);
|
|
15804
16016
|
case "zsh":
|
|
15805
16017
|
return path10.join(home, ".zsh", "completions", "_cloudeval");
|
|
15806
16018
|
case "fish":
|
|
15807
|
-
return path10.join(
|
|
16019
|
+
return path10.join(
|
|
16020
|
+
home,
|
|
16021
|
+
".config",
|
|
16022
|
+
"fish",
|
|
16023
|
+
"completions",
|
|
16024
|
+
"cloudeval.fish"
|
|
16025
|
+
);
|
|
15808
16026
|
case "powershell":
|
|
15809
|
-
return path10.join(
|
|
16027
|
+
return path10.join(
|
|
16028
|
+
home,
|
|
16029
|
+
".config",
|
|
16030
|
+
"powershell",
|
|
16031
|
+
"cloudeval-completion.ps1"
|
|
16032
|
+
);
|
|
15810
16033
|
}
|
|
15811
16034
|
};
|
|
15812
16035
|
var ZSH_FPATH_MARKER = "CloudEval CLI completions";
|
|
@@ -15830,7 +16053,11 @@ fpath=("$HOME/.zsh/completions" $fpath)
|
|
|
15830
16053
|
var installCompletionScript = async (shell, binaryName) => {
|
|
15831
16054
|
const scriptPath = completionScriptPath(shell);
|
|
15832
16055
|
await fs13.mkdir(path10.dirname(scriptPath), { recursive: true });
|
|
15833
|
-
await fs13.writeFile(
|
|
16056
|
+
await fs13.writeFile(
|
|
16057
|
+
scriptPath,
|
|
16058
|
+
buildCompletionScript(shell, binaryName),
|
|
16059
|
+
"utf8"
|
|
16060
|
+
);
|
|
15834
16061
|
if (shell === "zsh") {
|
|
15835
16062
|
await ensureZshCompletionFpath();
|
|
15836
16063
|
}
|
|
@@ -15844,7 +16071,7 @@ var uninstallCompletionScript = async (shell) => {
|
|
|
15844
16071
|
var runInteractiveLoginOnboarding = async (baseUrl, token) => {
|
|
15845
16072
|
const [{ render }, { Onboarding }] = await Promise.all([
|
|
15846
16073
|
import("ink"),
|
|
15847
|
-
import("./Onboarding-
|
|
16074
|
+
import("./Onboarding-ZHKPXN5Z.js")
|
|
15848
16075
|
]);
|
|
15849
16076
|
await new Promise((resolve) => {
|
|
15850
16077
|
let app;
|
|
@@ -15865,7 +16092,9 @@ var runInteractiveLoginOnboarding = async (baseUrl, token) => {
|
|
|
15865
16092
|
};
|
|
15866
16093
|
var readStdinValue = async () => {
|
|
15867
16094
|
if (process.stdin.isTTY) {
|
|
15868
|
-
throw new Error(
|
|
16095
|
+
throw new Error(
|
|
16096
|
+
"No stdin available. Pipe a value into --access-key-stdin."
|
|
16097
|
+
);
|
|
15869
16098
|
}
|
|
15870
16099
|
const chunks = [];
|
|
15871
16100
|
for await (const chunk of process.stdin) {
|
|
@@ -15918,7 +16147,9 @@ var progressEventFromChunk = (chunk, options) => {
|
|
|
15918
16147
|
return {
|
|
15919
16148
|
type: "action",
|
|
15920
16149
|
step: "hitl",
|
|
15921
|
-
message: truncateProgressText(
|
|
16150
|
+
message: truncateProgressText(
|
|
16151
|
+
firstQuestion?.text || "Human input required"
|
|
16152
|
+
)
|
|
15922
16153
|
};
|
|
15923
16154
|
}
|
|
15924
16155
|
if (chunk.type === "hitl_resume") {
|
|
@@ -15926,7 +16157,9 @@ var progressEventFromChunk = (chunk, options) => {
|
|
|
15926
16157
|
type: "action",
|
|
15927
16158
|
step: "hitl_resume",
|
|
15928
16159
|
status: chunk.status,
|
|
15929
|
-
message: truncateProgressText(
|
|
16160
|
+
message: truncateProgressText(
|
|
16161
|
+
chunk.message || "Resuming with supplied input"
|
|
16162
|
+
)
|
|
15930
16163
|
};
|
|
15931
16164
|
}
|
|
15932
16165
|
return null;
|
|
@@ -15953,7 +16186,11 @@ var normalizeModelEntry = (raw) => {
|
|
|
15953
16186
|
if (typeof id !== "string" || !id.trim()) {
|
|
15954
16187
|
return null;
|
|
15955
16188
|
}
|
|
15956
|
-
return {
|
|
16189
|
+
return {
|
|
16190
|
+
...value,
|
|
16191
|
+
id,
|
|
16192
|
+
name: typeof value.name === "string" ? value.name : id
|
|
16193
|
+
};
|
|
15957
16194
|
};
|
|
15958
16195
|
var normalizeModelsPayload2 = (payload) => {
|
|
15959
16196
|
const list = Array.isArray(payload) ? payload : Array.isArray(payload?.models) ? payload.models : Array.isArray(payload?.data) ? payload.data : Array.isArray(payload?.all) ? payload.all : [];
|
|
@@ -15974,12 +16211,15 @@ var assertModelAvailable2 = async (input) => {
|
|
|
15974
16211
|
return;
|
|
15975
16212
|
}
|
|
15976
16213
|
try {
|
|
15977
|
-
const response = await fetch(
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
16214
|
+
const response = await fetch(
|
|
16215
|
+
`${input.normalizeApiBase(input.baseUrl)}/models`,
|
|
16216
|
+
{
|
|
16217
|
+
headers: {
|
|
16218
|
+
Accept: "application/json",
|
|
16219
|
+
...input.authToken ? { Authorization: `Bearer ${input.authToken}` } : {}
|
|
16220
|
+
}
|
|
15981
16221
|
}
|
|
15982
|
-
|
|
16222
|
+
);
|
|
15983
16223
|
if (!response.ok) {
|
|
15984
16224
|
return;
|
|
15985
16225
|
}
|
|
@@ -16178,17 +16418,20 @@ var resolveBaseUrl = async (options, command) => {
|
|
|
16178
16418
|
});
|
|
16179
16419
|
}
|
|
16180
16420
|
try {
|
|
16181
|
-
const { getAuthStatus } = await import("./dist-
|
|
16421
|
+
const { getAuthStatus } = await import("./dist-6LEMVXIY.js");
|
|
16182
16422
|
const status = await getAuthStatus();
|
|
16183
16423
|
const storedBaseUrl = status.baseUrl;
|
|
16184
16424
|
if (storedBaseUrl && shouldUseStoredBaseUrl(storedBaseUrl)) {
|
|
16185
16425
|
return storedBaseUrl;
|
|
16186
16426
|
}
|
|
16187
16427
|
if (storedBaseUrl) {
|
|
16188
|
-
verboseLog(
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16428
|
+
verboseLog(
|
|
16429
|
+
"Ignoring stored local auth base URL. Use --base-url or CLOUDEVAL_BASE_URL for local backend testing.",
|
|
16430
|
+
{
|
|
16431
|
+
storedBaseUrl,
|
|
16432
|
+
selectedBaseUrl: configuredBaseUrl
|
|
16433
|
+
}
|
|
16434
|
+
);
|
|
16192
16435
|
}
|
|
16193
16436
|
} catch {
|
|
16194
16437
|
}
|
|
@@ -16201,7 +16444,9 @@ var resolveCliConfig = async (command) => {
|
|
|
16201
16444
|
return {};
|
|
16202
16445
|
}
|
|
16203
16446
|
};
|
|
16204
|
-
program.name("cloudeval").description(
|
|
16447
|
+
program.name("cloudeval").description(
|
|
16448
|
+
"CloudEval CLI. Run without arguments to open the Terminal UI; use subcommands for pipeable CLI workflows."
|
|
16449
|
+
).version(CLI_VERSION).addHelpText(
|
|
16205
16450
|
"after",
|
|
16206
16451
|
`
|
|
16207
16452
|
|
|
@@ -16214,11 +16459,20 @@ Examples:
|
|
|
16214
16459
|
cloudeval projects create --template-url https://example.com/template.json --format json
|
|
16215
16460
|
cloudeval projects export-diagram <id> --layout architecture --format png --labels all --output architecture.png
|
|
16216
16461
|
cloudeval reports download --project <id> --type all --output ./reports
|
|
16462
|
+
cloudeval reports download --project <id> --type all --format pdf --report-verbosity evidence --output ./report.pdf
|
|
16217
16463
|
cloudeval open project <id> --view both --layout dependency --print-url --no-open
|
|
16218
16464
|
cloudeval capabilities --format json
|
|
16219
16465
|
cloudeval update --check
|
|
16220
16466
|
`
|
|
16221
|
-
).option(
|
|
16467
|
+
).option(
|
|
16468
|
+
"--profile <name>",
|
|
16469
|
+
"Configuration profile",
|
|
16470
|
+
process.env.CLOUDEVAL_PROFILE
|
|
16471
|
+
).option("-v, --verbose", "Enable verbose logging", false).option(
|
|
16472
|
+
"--show-sensitive-ids",
|
|
16473
|
+
"Show full account/session identifiers in command output",
|
|
16474
|
+
false
|
|
16475
|
+
).hook("preAction", async (thisCommand, actionCommand) => {
|
|
16222
16476
|
const opts = typeof actionCommand.optsWithGlobals === "function" ? actionCommand.optsWithGlobals() : thisCommand.opts();
|
|
16223
16477
|
await initializeCommandTelemetry(actionCommand, opts);
|
|
16224
16478
|
setShowSensitiveIds(Boolean(opts.showSensitiveIds || opts.verbose));
|
|
@@ -16235,16 +16489,19 @@ Examples:
|
|
|
16235
16489
|
await finishCommandTelemetry(0);
|
|
16236
16490
|
});
|
|
16237
16491
|
program.addHelpCommand(false);
|
|
16238
|
-
program.command("login").description("Authenticate with Cloudeval").option(
|
|
16239
|
-
"--
|
|
16240
|
-
"
|
|
16241
|
-
|
|
16242
|
-
).option("
|
|
16492
|
+
program.command("login").description("Authenticate with Cloudeval").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option(
|
|
16493
|
+
"--headless",
|
|
16494
|
+
"Use device-code login flow (for SSH/headless terminals)",
|
|
16495
|
+
false
|
|
16496
|
+
).option("-v, --verbose", "Enable verbose logging", false).action(async (options) => {
|
|
16243
16497
|
if (options.verbose) {
|
|
16244
16498
|
setVerbose(true);
|
|
16245
16499
|
verboseLog("Login command started");
|
|
16246
16500
|
verboseLog("Base URL:", options.baseUrl);
|
|
16247
|
-
verboseLog(
|
|
16501
|
+
verboseLog(
|
|
16502
|
+
"Environment CLOUDEVAL_BASE_URL:",
|
|
16503
|
+
process.env.CLOUDEVAL_BASE_URL
|
|
16504
|
+
);
|
|
16248
16505
|
}
|
|
16249
16506
|
try {
|
|
16250
16507
|
const {
|
|
@@ -16252,7 +16509,7 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16252
16509
|
checkUserStatus,
|
|
16253
16510
|
ensurePlaygroundProject,
|
|
16254
16511
|
login
|
|
16255
|
-
} = await import("./dist-
|
|
16512
|
+
} = await import("./dist-6LEMVXIY.js");
|
|
16256
16513
|
assertSecureBaseUrl(options.baseUrl);
|
|
16257
16514
|
const headlessEnvironment = isHeadlessEnvironment();
|
|
16258
16515
|
const headlessLogin = options.headless || headlessEnvironment;
|
|
@@ -16271,7 +16528,9 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16271
16528
|
stdoutIsTTY: process.stdout.isTTY
|
|
16272
16529
|
});
|
|
16273
16530
|
if (onboardingMode === "interactive_steps") {
|
|
16274
|
-
console.log(
|
|
16531
|
+
console.log(
|
|
16532
|
+
"Complete CLI onboarding to set up your Playground project."
|
|
16533
|
+
);
|
|
16275
16534
|
await runInteractiveLoginOnboarding(options.baseUrl, token);
|
|
16276
16535
|
console.log("\u2705 Onboarding complete. Playground project ready.");
|
|
16277
16536
|
} else {
|
|
@@ -16290,19 +16549,17 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16290
16549
|
console.log("\u2705 Playground project ready.");
|
|
16291
16550
|
}
|
|
16292
16551
|
} else {
|
|
16293
|
-
await ensurePlaygroundProject(
|
|
16294
|
-
|
|
16295
|
-
|
|
16296
|
-
|
|
16297
|
-
|
|
16298
|
-
|
|
16299
|
-
full_name: userStatus.user.full_name,
|
|
16300
|
-
name: userStatus.user.name
|
|
16301
|
-
}
|
|
16302
|
-
);
|
|
16552
|
+
await ensurePlaygroundProject(options.baseUrl, token, {
|
|
16553
|
+
id: userStatus.user.id,
|
|
16554
|
+
email: userStatus.user.email,
|
|
16555
|
+
full_name: userStatus.user.full_name,
|
|
16556
|
+
name: userStatus.user.name
|
|
16557
|
+
});
|
|
16303
16558
|
}
|
|
16304
16559
|
} else {
|
|
16305
|
-
verboseLog(
|
|
16560
|
+
verboseLog(
|
|
16561
|
+
"Skipping Playground setup because authenticated user details were unavailable"
|
|
16562
|
+
);
|
|
16306
16563
|
}
|
|
16307
16564
|
await getActiveCliTelemetry()?.track("cli.auth", {
|
|
16308
16565
|
command: "login",
|
|
@@ -16321,13 +16578,9 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16321
16578
|
await exitCli(1, error);
|
|
16322
16579
|
}
|
|
16323
16580
|
});
|
|
16324
|
-
program.command("logout").description("Log out and clear stored authentication state").option(
|
|
16325
|
-
"--base-url <url>",
|
|
16326
|
-
"Backend base URL",
|
|
16327
|
-
DEFAULT_BASE_URL
|
|
16328
|
-
).option("--all-devices", "Revoke sessions on all devices", false).action(async (options) => {
|
|
16581
|
+
program.command("logout").description("Log out and clear stored authentication state").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option("--all-devices", "Revoke sessions on all devices", false).action(async (options) => {
|
|
16329
16582
|
try {
|
|
16330
|
-
const { assertSecureBaseUrl, logout } = await import("./dist-
|
|
16583
|
+
const { assertSecureBaseUrl, logout } = await import("./dist-6LEMVXIY.js");
|
|
16331
16584
|
assertSecureBaseUrl(options.baseUrl);
|
|
16332
16585
|
const result = await logout({
|
|
16333
16586
|
baseUrl: options.baseUrl,
|
|
@@ -16355,13 +16608,21 @@ program.command("logout").description("Log out and clear stored authentication s
|
|
|
16355
16608
|
}
|
|
16356
16609
|
});
|
|
16357
16610
|
var authCommand = program.command("auth").description("Authentication utilities");
|
|
16358
|
-
authCommand.command("status").description("Show current authentication status").option(
|
|
16359
|
-
"--
|
|
16360
|
-
"
|
|
16361
|
-
|
|
16362
|
-
).option(
|
|
16611
|
+
authCommand.command("status").description("Show current authentication status").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option(
|
|
16612
|
+
"--format <format>",
|
|
16613
|
+
"Output format: text, json, ndjson, markdown",
|
|
16614
|
+
"text"
|
|
16615
|
+
).option(
|
|
16616
|
+
"--show-sensitive-ids",
|
|
16617
|
+
"Show full account/session identifiers in command output",
|
|
16618
|
+
false
|
|
16619
|
+
).option(
|
|
16620
|
+
"-v, --verbose",
|
|
16621
|
+
"Enable verbose logging and show full non-token identifiers",
|
|
16622
|
+
false
|
|
16623
|
+
).action(async (options, command) => {
|
|
16363
16624
|
try {
|
|
16364
|
-
const { assertSecureBaseUrl, getAuthStatus } = await import("./dist-
|
|
16625
|
+
const { assertSecureBaseUrl, getAuthStatus } = await import("./dist-6LEMVXIY.js");
|
|
16365
16626
|
const effectiveBaseUrl = await resolveBaseUrl(options, command);
|
|
16366
16627
|
assertSecureBaseUrl(effectiveBaseUrl);
|
|
16367
16628
|
const status = await getAuthStatus(effectiveBaseUrl, { validate: true });
|
|
@@ -16410,7 +16671,9 @@ authCommand.command("status").description("Show current authentication status").
|
|
|
16410
16671
|
success: false,
|
|
16411
16672
|
errorCategory: classifyTelemetryError(error)
|
|
16412
16673
|
});
|
|
16413
|
-
console.error(
|
|
16674
|
+
console.error(
|
|
16675
|
+
`\u274C Failed to fetch auth status: ${error?.message || "Unknown error"}`
|
|
16676
|
+
);
|
|
16414
16677
|
await exitCli(1, error);
|
|
16415
16678
|
}
|
|
16416
16679
|
});
|
|
@@ -16522,19 +16785,21 @@ registerMcpCommand(program, {
|
|
|
16522
16785
|
registerUpdateCommand(program, { getTelemetry: getActiveCliTelemetry });
|
|
16523
16786
|
registerUninstallCommand(program);
|
|
16524
16787
|
var telemetryCommand = program.command("__telemetry", { hidden: true }).description("Internal telemetry utilities");
|
|
16525
|
-
telemetryCommand.command("install").description("Track a completed installer run").option("--installer-type <type>", "Installer type").option("--requested-version <version>", "Requested version").option("--resolved-version <version>", "Resolved version").option("--platform <platform>", "Target platform").option("--aliases <state>", "Alias setup state").option("--completions <state>", "Completion setup state").option("--mcp-setup <state>", "MCP setup state").option("--result <result>", "Installer result", "success").action(
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
|
|
16529
|
-
|
|
16530
|
-
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
});
|
|
16788
|
+
telemetryCommand.command("install").description("Track a completed installer run").option("--installer-type <type>", "Installer type").option("--requested-version <version>", "Requested version").option("--resolved-version <version>", "Resolved version").option("--platform <platform>", "Target platform").option("--aliases <state>", "Alias setup state").option("--completions <state>", "Completion setup state").option("--mcp-setup <state>", "MCP setup state").option("--result <result>", "Installer result", "success").action(
|
|
16789
|
+
async (options) => {
|
|
16790
|
+
await getActiveCliTelemetry()?.track("cli.install", {
|
|
16791
|
+
installerType: enumLikeValue(options.installerType),
|
|
16792
|
+
requestedVersion: versionLikeValue(options.requestedVersion),
|
|
16793
|
+
resolvedVersion: versionLikeValue(options.resolvedVersion),
|
|
16794
|
+
platform: enumLikeValue(options.platform),
|
|
16795
|
+
aliases: enumLikeValue(options.aliases),
|
|
16796
|
+
completions: enumLikeValue(options.completions),
|
|
16797
|
+
mcpSetup: enumLikeValue(options.mcpSetup),
|
|
16798
|
+
installerResult: enumLikeValue(options.result) ?? "success",
|
|
16799
|
+
success: options.result !== "failure"
|
|
16800
|
+
});
|
|
16801
|
+
}
|
|
16802
|
+
);
|
|
16538
16803
|
program.command("__complete").description("Internal completion endpoint").argument("[words...]", "Completion words").action((words = []) => {
|
|
16539
16804
|
const candidates = completeCliWords(words);
|
|
16540
16805
|
for (const candidate of candidates) {
|
|
@@ -16544,7 +16809,10 @@ program.command("__complete").description("Internal completion endpoint").argume
|
|
|
16544
16809
|
);
|
|
16545
16810
|
}
|
|
16546
16811
|
});
|
|
16547
|
-
var completionCommand = program.command("completion").description("Print or install shell completion scripts").argument(
|
|
16812
|
+
var completionCommand = program.command("completion").description("Print or install shell completion scripts").argument(
|
|
16813
|
+
"[shell]",
|
|
16814
|
+
"Shell to generate completions for: bash, zsh, fish, powershell"
|
|
16815
|
+
).option("--bin <name>", "Primary binary name", "cloudeval").action(async (shellName, options) => {
|
|
16548
16816
|
const detectedShell = process.env.SHELL?.split("/").pop();
|
|
16549
16817
|
const shell = normalizeCompletionShell(shellName || detectedShell);
|
|
16550
16818
|
if (!shell) {
|
|
@@ -16581,19 +16849,23 @@ completionCommand.command("uninstall").description("Remove installed shell compl
|
|
|
16581
16849
|
process.stdout.write(`Removed ${shell} completion at ${scriptPath}
|
|
16582
16850
|
`);
|
|
16583
16851
|
});
|
|
16584
|
-
program.command("tui").description("Open the CloudEval Terminal UI").option(
|
|
16585
|
-
"--
|
|
16586
|
-
"
|
|
16587
|
-
|
|
16588
|
-
).option("--
|
|
16852
|
+
program.command("tui").description("Open the CloudEval Terminal UI").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option(
|
|
16853
|
+
"--tab <tab>",
|
|
16854
|
+
"Initial tab: chat, overview, reports, projects, connections, billing, options, help",
|
|
16855
|
+
"chat"
|
|
16856
|
+
).option("--project <id>", "Initial project id").option("--frontend-url <url>", "Frontend base URL").option("--mode <mode>", "Initial chat mode: ask, agent").option(
|
|
16589
16857
|
"--access-key <key>",
|
|
16590
16858
|
"Access key for automation",
|
|
16591
16859
|
process.env.CLOUDEVAL_ACCESS_KEY
|
|
16592
|
-
).option(
|
|
16593
|
-
|
|
16860
|
+
).option(
|
|
16861
|
+
"--access-key-stdin",
|
|
16862
|
+
"Read access key from stdin (recommended for automation)",
|
|
16863
|
+
false
|
|
16864
|
+
).option("--model <name>", "Model name").option("--debug", "Log raw chunks", false).option("--health-check", "Enable health check (disabled by default)").option("--no-banner", "Disable ASCII banner").option("--animate", "Enable TUI animations (default)").option("--no-anim", "Disable TUI animations").option("-v, --verbose", "Enable verbose logging", false).action(async (options, command) => {
|
|
16865
|
+
const { assertSecureBaseUrl } = await import("./dist-6LEMVXIY.js");
|
|
16594
16866
|
const [{ render }, { App }] = await Promise.all([
|
|
16595
16867
|
import("ink"),
|
|
16596
|
-
import("./App-
|
|
16868
|
+
import("./App-FK5FKLOM.js")
|
|
16597
16869
|
]);
|
|
16598
16870
|
const baseUrl = await resolveBaseUrl(options, command);
|
|
16599
16871
|
assertSecureBaseUrl(baseUrl);
|
|
@@ -16639,19 +16911,22 @@ program.command("tui").description("Open the CloudEval Terminal UI").option(
|
|
|
16639
16911
|
);
|
|
16640
16912
|
await app.waitUntilExit();
|
|
16641
16913
|
});
|
|
16642
|
-
program.command("chat").description("Start an interactive chat session").option(
|
|
16643
|
-
"--base-url <url>",
|
|
16644
|
-
"Backend base URL",
|
|
16645
|
-
DEFAULT_BASE_URL
|
|
16646
|
-
).option(
|
|
16914
|
+
program.command("chat").description("Start an interactive chat session").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option(
|
|
16647
16915
|
"--access-key <key>",
|
|
16648
16916
|
"Access key for automation",
|
|
16649
16917
|
process.env.CLOUDEVAL_ACCESS_KEY
|
|
16650
|
-
).option(
|
|
16651
|
-
|
|
16918
|
+
).option(
|
|
16919
|
+
"--access-key-stdin",
|
|
16920
|
+
"Read access key from stdin (recommended for automation)",
|
|
16921
|
+
false
|
|
16922
|
+
).option("--conversation <id>", "Conversation/thread id to resume").option("--continue", "Resume the most recent local chat session", false).option(
|
|
16923
|
+
"--resume <id-or-title>",
|
|
16924
|
+
"Resume a local chat session by thread id or title"
|
|
16925
|
+
).option("--model <name>", "Model name").option("--mode <mode>", "Initial chat mode: ask, agent").option("--debug", "Log raw chunks", false).option("--health-check", "Enable health check (disabled by default)").option("--no-banner", "Disable ASCII banner").option("--animate", "Enable TUI animations (default)").option("--no-anim", "Disable TUI animations").option("-v, --verbose", "Enable verbose logging", false).action(async (options, command) => {
|
|
16926
|
+
const { assertSecureBaseUrl } = await import("./dist-6LEMVXIY.js");
|
|
16652
16927
|
const [{ render }, { App }] = await Promise.all([
|
|
16653
16928
|
import("ink"),
|
|
16654
|
-
import("./App-
|
|
16929
|
+
import("./App-FK5FKLOM.js")
|
|
16655
16930
|
]);
|
|
16656
16931
|
const baseUrl = await resolveBaseUrl(options, command);
|
|
16657
16932
|
assertSecureBaseUrl(baseUrl);
|
|
@@ -16714,19 +16989,27 @@ program.command("chat").description("Start an interactive chat session").option(
|
|
|
16714
16989
|
);
|
|
16715
16990
|
await app.waitUntilExit();
|
|
16716
16991
|
});
|
|
16717
|
-
program.command("ask").alias("agent").description("Ask a single question or run an agent task (non-interactive)").argument("<question...>", "The question to ask").option(
|
|
16718
|
-
"--base-url <url>",
|
|
16719
|
-
"Backend base URL",
|
|
16720
|
-
DEFAULT_BASE_URL
|
|
16721
|
-
).option(
|
|
16992
|
+
program.command("ask").alias("agent").description("Ask a single question or run an agent task (non-interactive)").argument("<question...>", "The question to ask").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option(
|
|
16722
16993
|
"--access-key <key>",
|
|
16723
16994
|
"Access key for automation",
|
|
16724
16995
|
process.env.CLOUDEVAL_ACCESS_KEY
|
|
16725
|
-
).option(
|
|
16996
|
+
).option(
|
|
16997
|
+
"--access-key-stdin",
|
|
16998
|
+
"Read access key from stdin (recommended for automation)",
|
|
16999
|
+
false
|
|
17000
|
+
).option("--project <id>", "Project ID to use").option("--model <name>", "Model name").option("--thread <id>", "Thread id to reuse").option("--output <file>", "Output file (default: stdout)").option(
|
|
17001
|
+
"--format <format>",
|
|
17002
|
+
"Output format: text, json, ndjson, markdown",
|
|
17003
|
+
"text"
|
|
17004
|
+
).option("--json", "Output as JSON").option(
|
|
17005
|
+
"--progress <mode>",
|
|
17006
|
+
"Progress events: auto, stderr, ndjson, none",
|
|
17007
|
+
"auto"
|
|
17008
|
+
).option("--quiet", "Suppress progress and warning messages", false).option("--no-color", "Disable colorized progress output").option("--open", "Open the frontend chat thread after completion", false).option("--print-url", "Print the frontend chat thread URL", false).option("--no-open", "Do not launch the browser when a URL is printed").option("--frontend-url <url>", "Frontend base URL").option("--non-interactive", "Disable prompts and browser login", false).option("--debug", "Log raw chunks", false).option("-v, --verbose", "Enable verbose logging", false).option("--no-hooks", "Disable local CLI hooks for this command").action(async (questionParts, options, command) => {
|
|
16726
17009
|
const question = Array.isArray(questionParts) ? questionParts.join(" ") : String(questionParts);
|
|
16727
17010
|
const commandName = command.parent?.args?.[0] === "agent" ? "agent" : "ask";
|
|
16728
17011
|
const selectedMode = commandName === "agent" ? "agent" : "ask";
|
|
16729
|
-
const { assertSecureBaseUrl } = await import("./dist-
|
|
17012
|
+
const { assertSecureBaseUrl } = await import("./dist-6LEMVXIY.js");
|
|
16730
17013
|
const baseUrl = await resolveBaseUrl(options, command);
|
|
16731
17014
|
assertSecureBaseUrl(baseUrl);
|
|
16732
17015
|
const selectedProfile = getActiveConfigProfile(command);
|
|
@@ -16767,7 +17050,7 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16767
17050
|
const fs14 = await import("fs");
|
|
16768
17051
|
const fsPromises = await import("fs/promises");
|
|
16769
17052
|
const { randomUUID: randomUUID5 } = await import("crypto");
|
|
16770
|
-
const core = await import("./dist-
|
|
17053
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
16771
17054
|
const {
|
|
16772
17055
|
streamChat,
|
|
16773
17056
|
reduceChunk,
|
|
@@ -16820,10 +17103,12 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16820
17103
|
verboseLog("No authentication available, initiating login flow");
|
|
16821
17104
|
if (!options.quiet) {
|
|
16822
17105
|
progressWriter.clear();
|
|
16823
|
-
console.error(
|
|
17106
|
+
console.error(
|
|
17107
|
+
"Authentication required. Starting login process...\n"
|
|
17108
|
+
);
|
|
16824
17109
|
}
|
|
16825
17110
|
try {
|
|
16826
|
-
const { login } = await import("./dist-
|
|
17111
|
+
const { login } = await import("./dist-6LEMVXIY.js");
|
|
16827
17112
|
verboseLog("Calling interactive login", { baseUrl });
|
|
16828
17113
|
token = await login(baseUrl, {
|
|
16829
17114
|
headless: isHeadlessEnvironment()
|
|
@@ -16831,7 +17116,9 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16831
17116
|
verboseLog("Login successful, proceeding with question");
|
|
16832
17117
|
if (!options.quiet) {
|
|
16833
17118
|
progressWriter.clear();
|
|
16834
|
-
console.error(
|
|
17119
|
+
console.error(
|
|
17120
|
+
"\nAuthentication successful. Proceeding with your question...\n"
|
|
17121
|
+
);
|
|
16835
17122
|
}
|
|
16836
17123
|
} catch (loginError) {
|
|
16837
17124
|
verboseLog("Login failed:", {
|
|
@@ -16887,7 +17174,7 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16887
17174
|
message: error.message
|
|
16888
17175
|
});
|
|
16889
17176
|
}
|
|
16890
|
-
const { resolveAskProject } = await import("./resolveAskProject-
|
|
17177
|
+
const { resolveAskProject } = await import("./resolveAskProject-XM4W4DON.js");
|
|
16891
17178
|
let project;
|
|
16892
17179
|
try {
|
|
16893
17180
|
project = await resolveAskProject({
|
|
@@ -16925,15 +17212,21 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16925
17212
|
const emittedProgressKeys = /* @__PURE__ */ new Set();
|
|
16926
17213
|
if (options.debug) {
|
|
16927
17214
|
console.error(`[${commandName}] Question: ${question}`);
|
|
16928
|
-
console.error(
|
|
17215
|
+
console.error(
|
|
17216
|
+
`[${commandName}] Project: ${project.id} (${project.name})`
|
|
17217
|
+
);
|
|
16929
17218
|
console.error(`[${commandName}] Thread ID: ${threadId}`);
|
|
16930
17219
|
}
|
|
16931
17220
|
if (streamTextOutput && options.output) {
|
|
16932
|
-
fileOutputStream = fs14.createWriteStream(options.output, {
|
|
17221
|
+
fileOutputStream = fs14.createWriteStream(options.output, {
|
|
17222
|
+
encoding: "utf-8"
|
|
17223
|
+
});
|
|
16933
17224
|
outputStream = fileOutputStream;
|
|
16934
17225
|
}
|
|
16935
17226
|
if (ndjsonOutput && options.output) {
|
|
16936
|
-
ndjsonOutputStream = fs14.createWriteStream(options.output, {
|
|
17227
|
+
ndjsonOutputStream = fs14.createWriteStream(options.output, {
|
|
17228
|
+
encoding: "utf-8"
|
|
17229
|
+
});
|
|
16937
17230
|
}
|
|
16938
17231
|
const writeAskDataEvent = (event) => {
|
|
16939
17232
|
const line = `${JSON.stringify(event)}
|
|
@@ -16961,12 +17254,9 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16961
17254
|
if (!event) {
|
|
16962
17255
|
return;
|
|
16963
17256
|
}
|
|
16964
|
-
const key = [
|
|
16965
|
-
|
|
16966
|
-
|
|
16967
|
-
event.status,
|
|
16968
|
-
event.message
|
|
16969
|
-
].join(":");
|
|
17257
|
+
const key = [event.type, event.step, event.status, event.message].join(
|
|
17258
|
+
":"
|
|
17259
|
+
);
|
|
16970
17260
|
if (emittedProgressKeys.has(key)) {
|
|
16971
17261
|
return;
|
|
16972
17262
|
}
|
|
@@ -16991,7 +17281,7 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16991
17281
|
});
|
|
16992
17282
|
const logHeaders = {
|
|
16993
17283
|
"Content-Type": "application/json",
|
|
16994
|
-
|
|
17284
|
+
Accept: "text/event-stream"
|
|
16995
17285
|
};
|
|
16996
17286
|
if (token) {
|
|
16997
17287
|
logHeaders["Authorization"] = `Bearer [REDACTED]`;
|
|
@@ -17029,7 +17319,10 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
17029
17319
|
authToken: token,
|
|
17030
17320
|
message: hitlResume ? "" : question,
|
|
17031
17321
|
threadId,
|
|
17032
|
-
user: {
|
|
17322
|
+
user: {
|
|
17323
|
+
id: project.user_id ?? authenticatedUserId ?? "cli-user",
|
|
17324
|
+
name: userName
|
|
17325
|
+
},
|
|
17033
17326
|
project,
|
|
17034
17327
|
settings: streamSettings,
|
|
17035
17328
|
debug: options.debug,
|
|
@@ -17051,7 +17344,9 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
17051
17344
|
});
|
|
17052
17345
|
}
|
|
17053
17346
|
chatState = reduceChunk(chatState, chunk);
|
|
17054
|
-
writeChunkProgressEvent(
|
|
17347
|
+
writeChunkProgressEvent(
|
|
17348
|
+
progressEventFromChunk(chunk, { verbose: options.verbose })
|
|
17349
|
+
);
|
|
17055
17350
|
if (chunk.type === "hitl_request") {
|
|
17056
17351
|
pendingHitlRequest = chunk;
|
|
17057
17352
|
if (ndjsonOutput) {
|
|
@@ -17100,7 +17395,11 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
17100
17395
|
if (jsonOutput) {
|
|
17101
17396
|
responseText = `Error: ${errorMsg}`;
|
|
17102
17397
|
} else if (ndjsonOutput) {
|
|
17103
|
-
writeAskDataEvent({
|
|
17398
|
+
writeAskDataEvent({
|
|
17399
|
+
type: "error",
|
|
17400
|
+
error: { message: errorMsg },
|
|
17401
|
+
threadId
|
|
17402
|
+
});
|
|
17104
17403
|
} else {
|
|
17105
17404
|
outputStream.write(`
|
|
17106
17405
|
Error: ${errorMsg}
|
|
@@ -17113,7 +17412,9 @@ Error: ${errorMsg}
|
|
|
17113
17412
|
} catch (error) {
|
|
17114
17413
|
if (!providedAccessKey && !retriedAfterAuthRefresh && isExpiredDeviceTokenStreamError(error)) {
|
|
17115
17414
|
retriedAfterAuthRefresh = true;
|
|
17116
|
-
verboseLog(
|
|
17415
|
+
verboseLog(
|
|
17416
|
+
"Stored device token expired during stream; refreshing and retrying once"
|
|
17417
|
+
);
|
|
17117
17418
|
progressWriter.write({
|
|
17118
17419
|
type: "auth",
|
|
17119
17420
|
step: "auth",
|
|
@@ -17143,7 +17444,11 @@ Error: ${errorMsg}
|
|
|
17143
17444
|
questions
|
|
17144
17445
|
};
|
|
17145
17446
|
const message = "Human input required by CloudEval.";
|
|
17146
|
-
const summary = summarizeHitlRequest({
|
|
17447
|
+
const summary = summarizeHitlRequest({
|
|
17448
|
+
questions,
|
|
17449
|
+
checkpointId,
|
|
17450
|
+
frontendUrl
|
|
17451
|
+
});
|
|
17147
17452
|
if (jsonOutput) {
|
|
17148
17453
|
const output = {
|
|
17149
17454
|
ok: false,
|
|
@@ -17172,7 +17477,11 @@ Error: ${errorMsg}
|
|
|
17172
17477
|
ok: false,
|
|
17173
17478
|
command: commandName,
|
|
17174
17479
|
error: { code: "HITL_REQUIRED", message },
|
|
17175
|
-
data: {
|
|
17480
|
+
data: {
|
|
17481
|
+
threadId: chatState.threadId,
|
|
17482
|
+
project: { id: project.id, name: project.name },
|
|
17483
|
+
hitl
|
|
17484
|
+
},
|
|
17176
17485
|
frontendUrl
|
|
17177
17486
|
});
|
|
17178
17487
|
await closeOutputStream();
|
|
@@ -17204,7 +17513,11 @@ Error: ${errorMsg}
|
|
|
17204
17513
|
if (jsonOutput) {
|
|
17205
17514
|
responseText = `Error: ${errorMsg}`;
|
|
17206
17515
|
} else if (ndjsonOutput) {
|
|
17207
|
-
writeAskDataEvent({
|
|
17516
|
+
writeAskDataEvent({
|
|
17517
|
+
type: "error",
|
|
17518
|
+
error: { message: errorMsg },
|
|
17519
|
+
threadId
|
|
17520
|
+
});
|
|
17208
17521
|
} else {
|
|
17209
17522
|
outputStream.write(`
|
|
17210
17523
|
Error: ${errorMsg}
|
|
@@ -17405,7 +17718,7 @@ Error: ${errorMsg}
|
|
|
17405
17718
|
program.command("banner").description("Preview the startup banner and terminal capabilities").action(async () => {
|
|
17406
17719
|
const { render } = await import("ink");
|
|
17407
17720
|
const BannerPreview = React.lazy(async () => ({
|
|
17408
|
-
default: (await import("./Banner-
|
|
17721
|
+
default: (await import("./Banner-XDSXKCKM.js")).Banner
|
|
17409
17722
|
}));
|
|
17410
17723
|
render(
|
|
17411
17724
|
/* @__PURE__ */ jsx(React.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(BannerPreview, { disable: false }) })
|