@ganakailabs/cloudeval-cli 0.29.3 → 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-7FR4HVBO.js → App-FK5FKLOM.js} +6 -6
- package/dist/{Banner-WWNHRGQD.js → Banner-XDSXKCKM.js} +2 -2
- package/dist/{Onboarding-HCORVZMZ.js → Onboarding-ZHKPXN5Z.js} +2 -2
- package/dist/{chunk-PN4AUAH6.js → chunk-C5GOTWYL.js} +1 -1
- package/dist/{chunk-D2ROSW4U.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 +685 -353
- 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
|
}
|
|
@@ -3469,6 +3670,16 @@ var renderAiSummarySections = (shortSummary, detailsMarkdown) => {
|
|
|
3469
3670
|
}
|
|
3470
3671
|
return lines.join("\n");
|
|
3471
3672
|
};
|
|
3673
|
+
var isInstructionLikeAiDetails = (detailsMarkdown) => {
|
|
3674
|
+
const normalized = detailsMarkdown.toLowerCase();
|
|
3675
|
+
return [
|
|
3676
|
+
"markdown for a collapsible ai details section",
|
|
3677
|
+
"use short paragraphs or bullets",
|
|
3678
|
+
"bold important evidence keywords",
|
|
3679
|
+
"prefer concrete failed test names",
|
|
3680
|
+
"headings: **main risk**"
|
|
3681
|
+
].some((marker) => normalized.includes(marker));
|
|
3682
|
+
};
|
|
3472
3683
|
var githubWorkflowRunUrl = () => {
|
|
3473
3684
|
const server = process.env.GITHUB_SERVER_URL;
|
|
3474
3685
|
const repo = process.env.GITHUB_REPOSITORY;
|
|
@@ -3553,15 +3764,24 @@ var generateAiSummary = async (input) => {
|
|
|
3553
3764
|
idempotencyKey: `cloudeval-review-summary-${input.data.projectId}-${input.data.commitSha ?? "head"}`
|
|
3554
3765
|
});
|
|
3555
3766
|
const shortSummary = String(response.summary ?? "").trim();
|
|
3556
|
-
|
|
3767
|
+
let detailsMarkdown = String(response.details ?? "").trim();
|
|
3557
3768
|
if (!shortSummary) {
|
|
3558
3769
|
return deterministicAiSummary(input.data, "Review summary endpoint returned no summary.");
|
|
3559
3770
|
}
|
|
3771
|
+
const warnings = Array.isArray(response.warnings) ? response.warnings : [];
|
|
3772
|
+
if (isInstructionLikeAiDetails(detailsMarkdown)) {
|
|
3773
|
+
const fallback = deterministicAiSummary(
|
|
3774
|
+
input.data,
|
|
3775
|
+
"Review summary endpoint returned instruction-like details."
|
|
3776
|
+
);
|
|
3777
|
+
detailsMarkdown = String(fallback.detailsMarkdown ?? "").trim();
|
|
3778
|
+
warnings.push("Review summary endpoint returned instruction-like details; using deterministic details.");
|
|
3779
|
+
}
|
|
3560
3780
|
return {
|
|
3561
3781
|
enabled: true,
|
|
3562
|
-
status: response.fallback_used ? "fallback" : "ok",
|
|
3563
|
-
fallbackUsed: Boolean(response.fallback_used),
|
|
3564
|
-
warnings
|
|
3782
|
+
status: response.fallback_used || warnings.length > 0 ? "fallback" : "ok",
|
|
3783
|
+
fallbackUsed: Boolean(response.fallback_used) || warnings.length > 0,
|
|
3784
|
+
warnings,
|
|
3565
3785
|
riskHighlights: Array.isArray(response.risk_highlights) ? response.risk_highlights : [],
|
|
3566
3786
|
recommendedActions: Array.isArray(response.recommended_actions) ? response.recommended_actions : [],
|
|
3567
3787
|
evidenceUsed: Array.isArray(response.evidence_used) ? response.evidence_used : [],
|
|
@@ -5250,7 +5470,7 @@ var runChatRecipe = async (recipe, prompt2, options, command, deps) => {
|
|
|
5250
5470
|
});
|
|
5251
5471
|
progressWriter.write({ type: "auth", step: "auth", message: "Resolving authentication" });
|
|
5252
5472
|
const context = await resolveAuthContext(options, command, deps);
|
|
5253
|
-
const core = await import("./dist-
|
|
5473
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
5254
5474
|
progressWriter.write({
|
|
5255
5475
|
type: "request",
|
|
5256
5476
|
step: "project",
|
|
@@ -6814,7 +7034,7 @@ var configureDiagramExportCommand = (command, deps) => addAuthOptions(command, d
|
|
|
6814
7034
|
const context = requireAuthUser(
|
|
6815
7035
|
await resolveAuthContext(options, actionCommand, deps)
|
|
6816
7036
|
);
|
|
6817
|
-
const core = await import("./dist-
|
|
7037
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
6818
7038
|
const projects = await core.getProjects(
|
|
6819
7039
|
context.baseUrl,
|
|
6820
7040
|
context.token,
|
|
@@ -6891,7 +7111,7 @@ var registerProjectsCommand = (program2, deps) => {
|
|
|
6891
7111
|
addCommon(addAuthOptions(projects.command("list").description("List projects"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
6892
7112
|
try {
|
|
6893
7113
|
const context = await resolveAuthContext(options, command, deps);
|
|
6894
|
-
const core = await import("./dist-
|
|
7114
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
6895
7115
|
const data = await listProjectsForContext(core, context);
|
|
6896
7116
|
const url = buildFrontendUrl({ baseUrl: frontendBase(context, options), target: "projects" });
|
|
6897
7117
|
await writeProjectListOutput({ data, options, frontendUrl: url });
|
|
@@ -6909,7 +7129,7 @@ var registerProjectsCommand = (program2, deps) => {
|
|
|
6909
7129
|
).action(async (id, options, command) => {
|
|
6910
7130
|
try {
|
|
6911
7131
|
const context = await resolveAuthContext(options, command, deps);
|
|
6912
|
-
const core = await import("./dist-
|
|
7132
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
6913
7133
|
const list = await listProjectsForContext(core, context);
|
|
6914
7134
|
const data = list.find((project) => project.id === id);
|
|
6915
7135
|
if (!data) {
|
|
@@ -6978,7 +7198,7 @@ var registerProjectsCommand = (program2, deps) => {
|
|
|
6978
7198
|
try {
|
|
6979
7199
|
assertSingleProjectSource(options);
|
|
6980
7200
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
6981
|
-
const core = await import("./dist-
|
|
7201
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
6982
7202
|
const template = await fileBlob(options.templateFile);
|
|
6983
7203
|
const parameters = await fileBlob(options.parametersFile);
|
|
6984
7204
|
const workspace = options.workspaceDir ? await collectWorkspaceFiles(options.workspaceDir, options) : void 0;
|
|
@@ -7103,7 +7323,7 @@ var registerIssuesInventoryCommand = (program2, deps) => {
|
|
|
7103
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) => {
|
|
7104
7324
|
try {
|
|
7105
7325
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7106
|
-
const core = await import("./dist-
|
|
7326
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7107
7327
|
const data = await core.listIssuesItems({
|
|
7108
7328
|
baseUrl: context.baseUrl,
|
|
7109
7329
|
authToken: context.token,
|
|
@@ -7151,7 +7371,7 @@ var registerIssuesInventoryCommand = (program2, deps) => {
|
|
|
7151
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) => {
|
|
7152
7372
|
try {
|
|
7153
7373
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7154
|
-
const core = await import("./dist-
|
|
7374
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7155
7375
|
const data = await core.getIssuesItem({
|
|
7156
7376
|
baseUrl: context.baseUrl,
|
|
7157
7377
|
authToken: context.token,
|
|
@@ -7272,7 +7492,7 @@ var registerConnectionsCommand = (program2, deps) => {
|
|
|
7272
7492
|
addCommon3(addAuthOptions(connections.command("list").description("List connections"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
7273
7493
|
try {
|
|
7274
7494
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7275
|
-
const core = await import("./dist-
|
|
7495
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7276
7496
|
const data = await core.listConnections({
|
|
7277
7497
|
baseUrl: context.baseUrl,
|
|
7278
7498
|
authToken: context.token,
|
|
@@ -7297,7 +7517,7 @@ var registerConnectionsCommand = (program2, deps) => {
|
|
|
7297
7517
|
).action(async (id, options, command) => {
|
|
7298
7518
|
try {
|
|
7299
7519
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7300
|
-
const core = await import("./dist-
|
|
7520
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7301
7521
|
const data = await core.getConnection({
|
|
7302
7522
|
baseUrl: context.baseUrl,
|
|
7303
7523
|
authToken: context.token,
|
|
@@ -7634,7 +7854,7 @@ var checkoutReturnUrl = (context, options) => options.returnTo || billingUrl(con
|
|
|
7634
7854
|
var runTopUpCheckout = async (commandName, packId, options, command, deps) => {
|
|
7635
7855
|
try {
|
|
7636
7856
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7637
|
-
const core = await import("./dist-
|
|
7857
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7638
7858
|
const returnTo = checkoutReturnUrl(context, options);
|
|
7639
7859
|
const session = await core.createTopUpCheckoutSession({
|
|
7640
7860
|
baseUrl: context.baseUrl,
|
|
@@ -7674,7 +7894,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7674
7894
|
).action(async (options, command) => {
|
|
7675
7895
|
try {
|
|
7676
7896
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7677
|
-
const core = await import("./dist-
|
|
7897
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7678
7898
|
const range = rangeToDates("30d");
|
|
7679
7899
|
const [entitlement, usageSummary] = await Promise.all([
|
|
7680
7900
|
core.getBillingEntitlement({
|
|
@@ -7704,7 +7924,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7704
7924
|
addCommon4(addAuthOptions(billing.command("summary").description("Show billing summary"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
7705
7925
|
try {
|
|
7706
7926
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7707
|
-
const core = await import("./dist-
|
|
7927
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7708
7928
|
const range = rangeToDates("30d");
|
|
7709
7929
|
const [entitlement, subscriptionStatus, usageSummary] = await Promise.all([
|
|
7710
7930
|
core.getBillingEntitlement({ baseUrl: context.baseUrl, authToken: context.token }),
|
|
@@ -7740,7 +7960,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7740
7960
|
addCommon4(addAuthOptions(billing.command("plans").description("Show billing plans"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
7741
7961
|
try {
|
|
7742
7962
|
const context = await resolveAuthContext(options, command, deps);
|
|
7743
|
-
const core = await import("./dist-
|
|
7963
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7744
7964
|
const data = await core.getBillingConfig({ baseUrl: context.baseUrl, authToken: context.token });
|
|
7745
7965
|
const url = billingUrl(context, { ...options, tab: "plans" });
|
|
7746
7966
|
await write("billing plans", data, options, url);
|
|
@@ -7752,7 +7972,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7752
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) => {
|
|
7753
7973
|
try {
|
|
7754
7974
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7755
|
-
const core = await import("./dist-
|
|
7975
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7756
7976
|
const range = rangeToDates(options.range);
|
|
7757
7977
|
const data = await core.getBillingUsageSummary({
|
|
7758
7978
|
baseUrl: context.baseUrl,
|
|
@@ -7775,7 +7995,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7775
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) => {
|
|
7776
7996
|
try {
|
|
7777
7997
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7778
|
-
const core = await import("./dist-
|
|
7998
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7779
7999
|
const range = rangeToDates(options.range);
|
|
7780
8000
|
const data = await core.getBillingUsageLedger({
|
|
7781
8001
|
baseUrl: context.baseUrl,
|
|
@@ -7803,7 +8023,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7803
8023
|
addCommon4(addAuthOptions(billing.command(name).description(`Show billing ${name}`), deps.defaultBaseUrl)).option("--limit <n>", "Result limit", "25").action(async (options, command) => {
|
|
7804
8024
|
try {
|
|
7805
8025
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7806
|
-
const core = await import("./dist-
|
|
8026
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7807
8027
|
const data = await core[getter]({
|
|
7808
8028
|
baseUrl: context.baseUrl,
|
|
7809
8029
|
authToken: context.token,
|
|
@@ -7821,7 +8041,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7821
8041
|
addCommon4(addAuthOptions(topups, deps.defaultBaseUrl)).option("--limit <n>", "Result limit", "25").action(async (options, command) => {
|
|
7822
8042
|
try {
|
|
7823
8043
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7824
|
-
const core = await import("./dist-
|
|
8044
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7825
8045
|
const data = await core.getTopUpPacks({
|
|
7826
8046
|
baseUrl: context.baseUrl,
|
|
7827
8047
|
authToken: context.token
|
|
@@ -10876,7 +11096,7 @@ var reportsFrontendUrl = (config, input) => buildFrontendUrl({
|
|
|
10876
11096
|
reportVerbosity: input.reportVerbosity
|
|
10877
11097
|
});
|
|
10878
11098
|
var resolveAuth = async (config, options = {}) => {
|
|
10879
|
-
const core = await import("./dist-
|
|
11099
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
10880
11100
|
core.assertSecureBaseUrl(config.baseUrl);
|
|
10881
11101
|
let token;
|
|
10882
11102
|
try {
|
|
@@ -10972,7 +11192,7 @@ var assertModelAvailable = async (config, token) => {
|
|
|
10972
11192
|
if (!config.model) {
|
|
10973
11193
|
return;
|
|
10974
11194
|
}
|
|
10975
|
-
const core = await import("./dist-
|
|
11195
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
10976
11196
|
try {
|
|
10977
11197
|
const response = await fetch(
|
|
10978
11198
|
`${core.normalizeApiBase(config.baseUrl)}/models`,
|
|
@@ -11229,7 +11449,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11229
11449
|
});
|
|
11230
11450
|
handlers.set("agent_profiles_list", async (args) => {
|
|
11231
11451
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11232
|
-
const core = await import("./dist-
|
|
11452
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11233
11453
|
const data = await listProfilesForDiscovery(core, config.baseUrl);
|
|
11234
11454
|
return withEnvelope({
|
|
11235
11455
|
command: "agents list",
|
|
@@ -11242,7 +11462,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11242
11462
|
throw new Error("profileId is required.");
|
|
11243
11463
|
}
|
|
11244
11464
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11245
|
-
const core = await import("./dist-
|
|
11465
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11246
11466
|
const data = await getProfileForDiscovery(core, config.baseUrl, profileId);
|
|
11247
11467
|
return withEnvelope({
|
|
11248
11468
|
command: "agents show",
|
|
@@ -11888,7 +12108,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11888
12108
|
});
|
|
11889
12109
|
handlers.set("auth_status", async (args) => {
|
|
11890
12110
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11891
|
-
const core = await import("./dist-
|
|
12111
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11892
12112
|
const data = await core.getAuthStatus(config.baseUrl, { validate: true });
|
|
11893
12113
|
return withEnvelope({
|
|
11894
12114
|
command: "auth status",
|
|
@@ -11897,7 +12117,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11897
12117
|
});
|
|
11898
12118
|
handlers.set("status", async (args) => {
|
|
11899
12119
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11900
|
-
const core = await import("./dist-
|
|
12120
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11901
12121
|
const auth = await core.getAuthStatus(config.baseUrl, { validate: true });
|
|
11902
12122
|
return withEnvelope({
|
|
11903
12123
|
command: "status",
|
|
@@ -11928,7 +12148,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11928
12148
|
}
|
|
11929
12149
|
];
|
|
11930
12150
|
try {
|
|
11931
|
-
const core = await import("./dist-
|
|
12151
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11932
12152
|
core.assertSecureBaseUrl(config.baseUrl);
|
|
11933
12153
|
checks.push({
|
|
11934
12154
|
id: "base-url-secure",
|
|
@@ -12448,7 +12668,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
12448
12668
|
} catch {
|
|
12449
12669
|
token = config.accessKey;
|
|
12450
12670
|
}
|
|
12451
|
-
const core = await import("./dist-
|
|
12671
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
12452
12672
|
const data = await core.getBillingConfig({
|
|
12453
12673
|
baseUrl: config.baseUrl,
|
|
12454
12674
|
authToken: token
|
|
@@ -13344,7 +13564,7 @@ var registerCapabilitiesCommand = (program2, deps) => {
|
|
|
13344
13564
|
warnIfAccessKeyFromCliOption(options, command);
|
|
13345
13565
|
let data = capabilities;
|
|
13346
13566
|
if (options.live) {
|
|
13347
|
-
const core = await import("./dist-
|
|
13567
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13348
13568
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
13349
13569
|
const accessKey = options.accessKeyStdin ? await deps.readStdinValue() : options.accessKey;
|
|
13350
13570
|
const token = await core.getAuthToken({ accessKey, baseUrl });
|
|
@@ -13482,7 +13702,7 @@ var writeCredentialOutput = async (input) => {
|
|
|
13482
13702
|
};
|
|
13483
13703
|
var resolveCoreAuth = async (options, command, deps) => {
|
|
13484
13704
|
const context = await resolveAuthContext(options, command, deps);
|
|
13485
|
-
const core = await import("./dist-
|
|
13705
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13486
13706
|
return { ...context, core };
|
|
13487
13707
|
};
|
|
13488
13708
|
var parseCapabilities = (value) => value?.split(",").map((item) => item.trim()).filter(Boolean);
|
|
@@ -13815,7 +14035,7 @@ var registerAgentsCommand = (program2, deps) => {
|
|
|
13815
14035
|
const agents = program2.command("agents").description("CloudEval Agent Profile utilities");
|
|
13816
14036
|
addAgentOutputOptions(agents.command("list").description("List Agent Profiles"), deps).action(async (options, command) => {
|
|
13817
14037
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
13818
|
-
const core = await import("./dist-
|
|
14038
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13819
14039
|
core.assertSecureBaseUrl(baseUrl);
|
|
13820
14040
|
const data = await listProfilesForDiscovery2(core, baseUrl);
|
|
13821
14041
|
await writeProfiles({
|
|
@@ -13831,7 +14051,7 @@ var registerAgentsCommand = (program2, deps) => {
|
|
|
13831
14051
|
deps
|
|
13832
14052
|
).action(async (profileId, options, command) => {
|
|
13833
14053
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
13834
|
-
const core = await import("./dist-
|
|
14054
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13835
14055
|
core.assertSecureBaseUrl(baseUrl);
|
|
13836
14056
|
const data = await getProfileForDiscovery2(core, baseUrl, profileId);
|
|
13837
14057
|
await writeProfiles({
|
|
@@ -13850,7 +14070,7 @@ var registerAgentsCommand = (program2, deps) => {
|
|
|
13850
14070
|
const cliProfile = getActiveConfigProfile(command);
|
|
13851
14071
|
const cliConfig = await loadCliConfig(cliProfile);
|
|
13852
14072
|
const auth = await resolveAuthContext(options, command, deps);
|
|
13853
|
-
const core = await import("./dist-
|
|
14073
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13854
14074
|
const profileResponse = await core.getAgentProfile({
|
|
13855
14075
|
baseUrl: auth.baseUrl,
|
|
13856
14076
|
authToken: auth.token,
|
|
@@ -14412,7 +14632,7 @@ var registerDiagnosticsCommands = (program2, deps) => {
|
|
|
14412
14632
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
14413
14633
|
const profile = getActiveConfigProfile(command);
|
|
14414
14634
|
const config = await loadCliConfig(profile);
|
|
14415
|
-
const core = await import("./dist-
|
|
14635
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14416
14636
|
const auth = await core.getAuthStatus(baseUrl, { validate: true });
|
|
14417
14637
|
if (options.format === "text" || !options.format) {
|
|
14418
14638
|
process.stdout.write(
|
|
@@ -14462,7 +14682,7 @@ var registerDiagnosticsCommands = (program2, deps) => {
|
|
|
14462
14682
|
detail: getCliConfigPath(profile)
|
|
14463
14683
|
});
|
|
14464
14684
|
try {
|
|
14465
|
-
const core = await import("./dist-
|
|
14685
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14466
14686
|
core.assertSecureBaseUrl(baseUrl);
|
|
14467
14687
|
checks.push({
|
|
14468
14688
|
id: "base-url-secure",
|
|
@@ -14562,7 +14782,7 @@ var resolveToken2 = async (options, deps, baseUrl, command) => {
|
|
|
14562
14782
|
return options.accessKey;
|
|
14563
14783
|
}
|
|
14564
14784
|
try {
|
|
14565
|
-
const core = await import("./dist-
|
|
14785
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14566
14786
|
return await core.getAuthToken({
|
|
14567
14787
|
baseUrl
|
|
14568
14788
|
});
|
|
@@ -14646,7 +14866,7 @@ var registerModelsCommand = (program2, deps) => {
|
|
|
14646
14866
|
let source = "fallback";
|
|
14647
14867
|
let modelList = fallbackModels;
|
|
14648
14868
|
try {
|
|
14649
|
-
const core = await import("./dist-
|
|
14869
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14650
14870
|
const response = await fetch(`${core.normalizeApiBase(baseUrl)}/models`, {
|
|
14651
14871
|
headers: {
|
|
14652
14872
|
Accept: "application/json",
|
|
@@ -15767,9 +15987,13 @@ var enableCliDebugLogging = () => {
|
|
|
15767
15987
|
process.env.CLOUDEVAL_CLI_DEBUG = "1";
|
|
15768
15988
|
};
|
|
15769
15989
|
var redactSensitive = (value) => redactSensitiveSecrets(value);
|
|
15770
|
-
var isHeadlessEnvironment = () => Boolean(
|
|
15990
|
+
var isHeadlessEnvironment = () => Boolean(
|
|
15991
|
+
process.env.SSH_TTY || process.env.CI || process.env.CLOUDEVAL_HEADLESS_LOGIN
|
|
15992
|
+
);
|
|
15771
15993
|
var assertNoLegacyApiKeyUsage = () => {
|
|
15772
|
-
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
|
+
);
|
|
15773
15997
|
if (legacyArg || process.env.CLOUDEVAL_API_KEY) {
|
|
15774
15998
|
process.stderr.write(`${LEGACY_API_KEY_MESSAGE}
|
|
15775
15999
|
`);
|
|
@@ -15781,13 +16005,31 @@ var completionScriptPath = (shell) => {
|
|
|
15781
16005
|
const home = os6.homedir();
|
|
15782
16006
|
switch (shell) {
|
|
15783
16007
|
case "bash":
|
|
15784
|
-
return path10.join(
|
|
16008
|
+
return path10.join(
|
|
16009
|
+
home,
|
|
16010
|
+
".local",
|
|
16011
|
+
"share",
|
|
16012
|
+
"bash-completion",
|
|
16013
|
+
"completions",
|
|
16014
|
+
"cloudeval"
|
|
16015
|
+
);
|
|
15785
16016
|
case "zsh":
|
|
15786
16017
|
return path10.join(home, ".zsh", "completions", "_cloudeval");
|
|
15787
16018
|
case "fish":
|
|
15788
|
-
return path10.join(
|
|
16019
|
+
return path10.join(
|
|
16020
|
+
home,
|
|
16021
|
+
".config",
|
|
16022
|
+
"fish",
|
|
16023
|
+
"completions",
|
|
16024
|
+
"cloudeval.fish"
|
|
16025
|
+
);
|
|
15789
16026
|
case "powershell":
|
|
15790
|
-
return path10.join(
|
|
16027
|
+
return path10.join(
|
|
16028
|
+
home,
|
|
16029
|
+
".config",
|
|
16030
|
+
"powershell",
|
|
16031
|
+
"cloudeval-completion.ps1"
|
|
16032
|
+
);
|
|
15791
16033
|
}
|
|
15792
16034
|
};
|
|
15793
16035
|
var ZSH_FPATH_MARKER = "CloudEval CLI completions";
|
|
@@ -15811,7 +16053,11 @@ fpath=("$HOME/.zsh/completions" $fpath)
|
|
|
15811
16053
|
var installCompletionScript = async (shell, binaryName) => {
|
|
15812
16054
|
const scriptPath = completionScriptPath(shell);
|
|
15813
16055
|
await fs13.mkdir(path10.dirname(scriptPath), { recursive: true });
|
|
15814
|
-
await fs13.writeFile(
|
|
16056
|
+
await fs13.writeFile(
|
|
16057
|
+
scriptPath,
|
|
16058
|
+
buildCompletionScript(shell, binaryName),
|
|
16059
|
+
"utf8"
|
|
16060
|
+
);
|
|
15815
16061
|
if (shell === "zsh") {
|
|
15816
16062
|
await ensureZshCompletionFpath();
|
|
15817
16063
|
}
|
|
@@ -15825,7 +16071,7 @@ var uninstallCompletionScript = async (shell) => {
|
|
|
15825
16071
|
var runInteractiveLoginOnboarding = async (baseUrl, token) => {
|
|
15826
16072
|
const [{ render }, { Onboarding }] = await Promise.all([
|
|
15827
16073
|
import("ink"),
|
|
15828
|
-
import("./Onboarding-
|
|
16074
|
+
import("./Onboarding-ZHKPXN5Z.js")
|
|
15829
16075
|
]);
|
|
15830
16076
|
await new Promise((resolve) => {
|
|
15831
16077
|
let app;
|
|
@@ -15846,7 +16092,9 @@ var runInteractiveLoginOnboarding = async (baseUrl, token) => {
|
|
|
15846
16092
|
};
|
|
15847
16093
|
var readStdinValue = async () => {
|
|
15848
16094
|
if (process.stdin.isTTY) {
|
|
15849
|
-
throw new Error(
|
|
16095
|
+
throw new Error(
|
|
16096
|
+
"No stdin available. Pipe a value into --access-key-stdin."
|
|
16097
|
+
);
|
|
15850
16098
|
}
|
|
15851
16099
|
const chunks = [];
|
|
15852
16100
|
for await (const chunk of process.stdin) {
|
|
@@ -15899,7 +16147,9 @@ var progressEventFromChunk = (chunk, options) => {
|
|
|
15899
16147
|
return {
|
|
15900
16148
|
type: "action",
|
|
15901
16149
|
step: "hitl",
|
|
15902
|
-
message: truncateProgressText(
|
|
16150
|
+
message: truncateProgressText(
|
|
16151
|
+
firstQuestion?.text || "Human input required"
|
|
16152
|
+
)
|
|
15903
16153
|
};
|
|
15904
16154
|
}
|
|
15905
16155
|
if (chunk.type === "hitl_resume") {
|
|
@@ -15907,7 +16157,9 @@ var progressEventFromChunk = (chunk, options) => {
|
|
|
15907
16157
|
type: "action",
|
|
15908
16158
|
step: "hitl_resume",
|
|
15909
16159
|
status: chunk.status,
|
|
15910
|
-
message: truncateProgressText(
|
|
16160
|
+
message: truncateProgressText(
|
|
16161
|
+
chunk.message || "Resuming with supplied input"
|
|
16162
|
+
)
|
|
15911
16163
|
};
|
|
15912
16164
|
}
|
|
15913
16165
|
return null;
|
|
@@ -15934,7 +16186,11 @@ var normalizeModelEntry = (raw) => {
|
|
|
15934
16186
|
if (typeof id !== "string" || !id.trim()) {
|
|
15935
16187
|
return null;
|
|
15936
16188
|
}
|
|
15937
|
-
return {
|
|
16189
|
+
return {
|
|
16190
|
+
...value,
|
|
16191
|
+
id,
|
|
16192
|
+
name: typeof value.name === "string" ? value.name : id
|
|
16193
|
+
};
|
|
15938
16194
|
};
|
|
15939
16195
|
var normalizeModelsPayload2 = (payload) => {
|
|
15940
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 : [];
|
|
@@ -15955,12 +16211,15 @@ var assertModelAvailable2 = async (input) => {
|
|
|
15955
16211
|
return;
|
|
15956
16212
|
}
|
|
15957
16213
|
try {
|
|
15958
|
-
const response = await fetch(
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
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
|
+
}
|
|
15962
16221
|
}
|
|
15963
|
-
|
|
16222
|
+
);
|
|
15964
16223
|
if (!response.ok) {
|
|
15965
16224
|
return;
|
|
15966
16225
|
}
|
|
@@ -16159,17 +16418,20 @@ var resolveBaseUrl = async (options, command) => {
|
|
|
16159
16418
|
});
|
|
16160
16419
|
}
|
|
16161
16420
|
try {
|
|
16162
|
-
const { getAuthStatus } = await import("./dist-
|
|
16421
|
+
const { getAuthStatus } = await import("./dist-6LEMVXIY.js");
|
|
16163
16422
|
const status = await getAuthStatus();
|
|
16164
16423
|
const storedBaseUrl = status.baseUrl;
|
|
16165
16424
|
if (storedBaseUrl && shouldUseStoredBaseUrl(storedBaseUrl)) {
|
|
16166
16425
|
return storedBaseUrl;
|
|
16167
16426
|
}
|
|
16168
16427
|
if (storedBaseUrl) {
|
|
16169
|
-
verboseLog(
|
|
16170
|
-
|
|
16171
|
-
|
|
16172
|
-
|
|
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
|
+
);
|
|
16173
16435
|
}
|
|
16174
16436
|
} catch {
|
|
16175
16437
|
}
|
|
@@ -16182,7 +16444,9 @@ var resolveCliConfig = async (command) => {
|
|
|
16182
16444
|
return {};
|
|
16183
16445
|
}
|
|
16184
16446
|
};
|
|
16185
|
-
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(
|
|
16186
16450
|
"after",
|
|
16187
16451
|
`
|
|
16188
16452
|
|
|
@@ -16195,11 +16459,20 @@ Examples:
|
|
|
16195
16459
|
cloudeval projects create --template-url https://example.com/template.json --format json
|
|
16196
16460
|
cloudeval projects export-diagram <id> --layout architecture --format png --labels all --output architecture.png
|
|
16197
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
|
|
16198
16463
|
cloudeval open project <id> --view both --layout dependency --print-url --no-open
|
|
16199
16464
|
cloudeval capabilities --format json
|
|
16200
16465
|
cloudeval update --check
|
|
16201
16466
|
`
|
|
16202
|
-
).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) => {
|
|
16203
16476
|
const opts = typeof actionCommand.optsWithGlobals === "function" ? actionCommand.optsWithGlobals() : thisCommand.opts();
|
|
16204
16477
|
await initializeCommandTelemetry(actionCommand, opts);
|
|
16205
16478
|
setShowSensitiveIds(Boolean(opts.showSensitiveIds || opts.verbose));
|
|
@@ -16216,16 +16489,19 @@ Examples:
|
|
|
16216
16489
|
await finishCommandTelemetry(0);
|
|
16217
16490
|
});
|
|
16218
16491
|
program.addHelpCommand(false);
|
|
16219
|
-
program.command("login").description("Authenticate with Cloudeval").option(
|
|
16220
|
-
"--
|
|
16221
|
-
"
|
|
16222
|
-
|
|
16223
|
-
).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) => {
|
|
16224
16497
|
if (options.verbose) {
|
|
16225
16498
|
setVerbose(true);
|
|
16226
16499
|
verboseLog("Login command started");
|
|
16227
16500
|
verboseLog("Base URL:", options.baseUrl);
|
|
16228
|
-
verboseLog(
|
|
16501
|
+
verboseLog(
|
|
16502
|
+
"Environment CLOUDEVAL_BASE_URL:",
|
|
16503
|
+
process.env.CLOUDEVAL_BASE_URL
|
|
16504
|
+
);
|
|
16229
16505
|
}
|
|
16230
16506
|
try {
|
|
16231
16507
|
const {
|
|
@@ -16233,7 +16509,7 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16233
16509
|
checkUserStatus,
|
|
16234
16510
|
ensurePlaygroundProject,
|
|
16235
16511
|
login
|
|
16236
|
-
} = await import("./dist-
|
|
16512
|
+
} = await import("./dist-6LEMVXIY.js");
|
|
16237
16513
|
assertSecureBaseUrl(options.baseUrl);
|
|
16238
16514
|
const headlessEnvironment = isHeadlessEnvironment();
|
|
16239
16515
|
const headlessLogin = options.headless || headlessEnvironment;
|
|
@@ -16252,7 +16528,9 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16252
16528
|
stdoutIsTTY: process.stdout.isTTY
|
|
16253
16529
|
});
|
|
16254
16530
|
if (onboardingMode === "interactive_steps") {
|
|
16255
|
-
console.log(
|
|
16531
|
+
console.log(
|
|
16532
|
+
"Complete CLI onboarding to set up your Playground project."
|
|
16533
|
+
);
|
|
16256
16534
|
await runInteractiveLoginOnboarding(options.baseUrl, token);
|
|
16257
16535
|
console.log("\u2705 Onboarding complete. Playground project ready.");
|
|
16258
16536
|
} else {
|
|
@@ -16271,19 +16549,17 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16271
16549
|
console.log("\u2705 Playground project ready.");
|
|
16272
16550
|
}
|
|
16273
16551
|
} else {
|
|
16274
|
-
await ensurePlaygroundProject(
|
|
16275
|
-
|
|
16276
|
-
|
|
16277
|
-
|
|
16278
|
-
|
|
16279
|
-
|
|
16280
|
-
full_name: userStatus.user.full_name,
|
|
16281
|
-
name: userStatus.user.name
|
|
16282
|
-
}
|
|
16283
|
-
);
|
|
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
|
+
});
|
|
16284
16558
|
}
|
|
16285
16559
|
} else {
|
|
16286
|
-
verboseLog(
|
|
16560
|
+
verboseLog(
|
|
16561
|
+
"Skipping Playground setup because authenticated user details were unavailable"
|
|
16562
|
+
);
|
|
16287
16563
|
}
|
|
16288
16564
|
await getActiveCliTelemetry()?.track("cli.auth", {
|
|
16289
16565
|
command: "login",
|
|
@@ -16302,13 +16578,9 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16302
16578
|
await exitCli(1, error);
|
|
16303
16579
|
}
|
|
16304
16580
|
});
|
|
16305
|
-
program.command("logout").description("Log out and clear stored authentication state").option(
|
|
16306
|
-
"--base-url <url>",
|
|
16307
|
-
"Backend base URL",
|
|
16308
|
-
DEFAULT_BASE_URL
|
|
16309
|
-
).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) => {
|
|
16310
16582
|
try {
|
|
16311
|
-
const { assertSecureBaseUrl, logout } = await import("./dist-
|
|
16583
|
+
const { assertSecureBaseUrl, logout } = await import("./dist-6LEMVXIY.js");
|
|
16312
16584
|
assertSecureBaseUrl(options.baseUrl);
|
|
16313
16585
|
const result = await logout({
|
|
16314
16586
|
baseUrl: options.baseUrl,
|
|
@@ -16336,13 +16608,21 @@ program.command("logout").description("Log out and clear stored authentication s
|
|
|
16336
16608
|
}
|
|
16337
16609
|
});
|
|
16338
16610
|
var authCommand = program.command("auth").description("Authentication utilities");
|
|
16339
|
-
authCommand.command("status").description("Show current authentication status").option(
|
|
16340
|
-
"--
|
|
16341
|
-
"
|
|
16342
|
-
|
|
16343
|
-
).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) => {
|
|
16344
16624
|
try {
|
|
16345
|
-
const { assertSecureBaseUrl, getAuthStatus } = await import("./dist-
|
|
16625
|
+
const { assertSecureBaseUrl, getAuthStatus } = await import("./dist-6LEMVXIY.js");
|
|
16346
16626
|
const effectiveBaseUrl = await resolveBaseUrl(options, command);
|
|
16347
16627
|
assertSecureBaseUrl(effectiveBaseUrl);
|
|
16348
16628
|
const status = await getAuthStatus(effectiveBaseUrl, { validate: true });
|
|
@@ -16391,7 +16671,9 @@ authCommand.command("status").description("Show current authentication status").
|
|
|
16391
16671
|
success: false,
|
|
16392
16672
|
errorCategory: classifyTelemetryError(error)
|
|
16393
16673
|
});
|
|
16394
|
-
console.error(
|
|
16674
|
+
console.error(
|
|
16675
|
+
`\u274C Failed to fetch auth status: ${error?.message || "Unknown error"}`
|
|
16676
|
+
);
|
|
16395
16677
|
await exitCli(1, error);
|
|
16396
16678
|
}
|
|
16397
16679
|
});
|
|
@@ -16503,19 +16785,21 @@ registerMcpCommand(program, {
|
|
|
16503
16785
|
registerUpdateCommand(program, { getTelemetry: getActiveCliTelemetry });
|
|
16504
16786
|
registerUninstallCommand(program);
|
|
16505
16787
|
var telemetryCommand = program.command("__telemetry", { hidden: true }).description("Internal telemetry utilities");
|
|
16506
|
-
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(
|
|
16507
|
-
|
|
16508
|
-
|
|
16509
|
-
|
|
16510
|
-
|
|
16511
|
-
|
|
16512
|
-
|
|
16513
|
-
|
|
16514
|
-
|
|
16515
|
-
|
|
16516
|
-
|
|
16517
|
-
|
|
16518
|
-
});
|
|
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
|
+
);
|
|
16519
16803
|
program.command("__complete").description("Internal completion endpoint").argument("[words...]", "Completion words").action((words = []) => {
|
|
16520
16804
|
const candidates = completeCliWords(words);
|
|
16521
16805
|
for (const candidate of candidates) {
|
|
@@ -16525,7 +16809,10 @@ program.command("__complete").description("Internal completion endpoint").argume
|
|
|
16525
16809
|
);
|
|
16526
16810
|
}
|
|
16527
16811
|
});
|
|
16528
|
-
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) => {
|
|
16529
16816
|
const detectedShell = process.env.SHELL?.split("/").pop();
|
|
16530
16817
|
const shell = normalizeCompletionShell(shellName || detectedShell);
|
|
16531
16818
|
if (!shell) {
|
|
@@ -16562,19 +16849,23 @@ completionCommand.command("uninstall").description("Remove installed shell compl
|
|
|
16562
16849
|
process.stdout.write(`Removed ${shell} completion at ${scriptPath}
|
|
16563
16850
|
`);
|
|
16564
16851
|
});
|
|
16565
|
-
program.command("tui").description("Open the CloudEval Terminal UI").option(
|
|
16566
|
-
"--
|
|
16567
|
-
"
|
|
16568
|
-
|
|
16569
|
-
).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(
|
|
16570
16857
|
"--access-key <key>",
|
|
16571
16858
|
"Access key for automation",
|
|
16572
16859
|
process.env.CLOUDEVAL_ACCESS_KEY
|
|
16573
|
-
).option(
|
|
16574
|
-
|
|
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");
|
|
16575
16866
|
const [{ render }, { App }] = await Promise.all([
|
|
16576
16867
|
import("ink"),
|
|
16577
|
-
import("./App-
|
|
16868
|
+
import("./App-FK5FKLOM.js")
|
|
16578
16869
|
]);
|
|
16579
16870
|
const baseUrl = await resolveBaseUrl(options, command);
|
|
16580
16871
|
assertSecureBaseUrl(baseUrl);
|
|
@@ -16620,19 +16911,22 @@ program.command("tui").description("Open the CloudEval Terminal UI").option(
|
|
|
16620
16911
|
);
|
|
16621
16912
|
await app.waitUntilExit();
|
|
16622
16913
|
});
|
|
16623
|
-
program.command("chat").description("Start an interactive chat session").option(
|
|
16624
|
-
"--base-url <url>",
|
|
16625
|
-
"Backend base URL",
|
|
16626
|
-
DEFAULT_BASE_URL
|
|
16627
|
-
).option(
|
|
16914
|
+
program.command("chat").description("Start an interactive chat session").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option(
|
|
16628
16915
|
"--access-key <key>",
|
|
16629
16916
|
"Access key for automation",
|
|
16630
16917
|
process.env.CLOUDEVAL_ACCESS_KEY
|
|
16631
|
-
).option(
|
|
16632
|
-
|
|
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");
|
|
16633
16927
|
const [{ render }, { App }] = await Promise.all([
|
|
16634
16928
|
import("ink"),
|
|
16635
|
-
import("./App-
|
|
16929
|
+
import("./App-FK5FKLOM.js")
|
|
16636
16930
|
]);
|
|
16637
16931
|
const baseUrl = await resolveBaseUrl(options, command);
|
|
16638
16932
|
assertSecureBaseUrl(baseUrl);
|
|
@@ -16695,19 +16989,27 @@ program.command("chat").description("Start an interactive chat session").option(
|
|
|
16695
16989
|
);
|
|
16696
16990
|
await app.waitUntilExit();
|
|
16697
16991
|
});
|
|
16698
|
-
program.command("ask").alias("agent").description("Ask a single question or run an agent task (non-interactive)").argument("<question...>", "The question to ask").option(
|
|
16699
|
-
"--base-url <url>",
|
|
16700
|
-
"Backend base URL",
|
|
16701
|
-
DEFAULT_BASE_URL
|
|
16702
|
-
).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(
|
|
16703
16993
|
"--access-key <key>",
|
|
16704
16994
|
"Access key for automation",
|
|
16705
16995
|
process.env.CLOUDEVAL_ACCESS_KEY
|
|
16706
|
-
).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) => {
|
|
16707
17009
|
const question = Array.isArray(questionParts) ? questionParts.join(" ") : String(questionParts);
|
|
16708
17010
|
const commandName = command.parent?.args?.[0] === "agent" ? "agent" : "ask";
|
|
16709
17011
|
const selectedMode = commandName === "agent" ? "agent" : "ask";
|
|
16710
|
-
const { assertSecureBaseUrl } = await import("./dist-
|
|
17012
|
+
const { assertSecureBaseUrl } = await import("./dist-6LEMVXIY.js");
|
|
16711
17013
|
const baseUrl = await resolveBaseUrl(options, command);
|
|
16712
17014
|
assertSecureBaseUrl(baseUrl);
|
|
16713
17015
|
const selectedProfile = getActiveConfigProfile(command);
|
|
@@ -16748,7 +17050,7 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16748
17050
|
const fs14 = await import("fs");
|
|
16749
17051
|
const fsPromises = await import("fs/promises");
|
|
16750
17052
|
const { randomUUID: randomUUID5 } = await import("crypto");
|
|
16751
|
-
const core = await import("./dist-
|
|
17053
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
16752
17054
|
const {
|
|
16753
17055
|
streamChat,
|
|
16754
17056
|
reduceChunk,
|
|
@@ -16801,10 +17103,12 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16801
17103
|
verboseLog("No authentication available, initiating login flow");
|
|
16802
17104
|
if (!options.quiet) {
|
|
16803
17105
|
progressWriter.clear();
|
|
16804
|
-
console.error(
|
|
17106
|
+
console.error(
|
|
17107
|
+
"Authentication required. Starting login process...\n"
|
|
17108
|
+
);
|
|
16805
17109
|
}
|
|
16806
17110
|
try {
|
|
16807
|
-
const { login } = await import("./dist-
|
|
17111
|
+
const { login } = await import("./dist-6LEMVXIY.js");
|
|
16808
17112
|
verboseLog("Calling interactive login", { baseUrl });
|
|
16809
17113
|
token = await login(baseUrl, {
|
|
16810
17114
|
headless: isHeadlessEnvironment()
|
|
@@ -16812,7 +17116,9 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16812
17116
|
verboseLog("Login successful, proceeding with question");
|
|
16813
17117
|
if (!options.quiet) {
|
|
16814
17118
|
progressWriter.clear();
|
|
16815
|
-
console.error(
|
|
17119
|
+
console.error(
|
|
17120
|
+
"\nAuthentication successful. Proceeding with your question...\n"
|
|
17121
|
+
);
|
|
16816
17122
|
}
|
|
16817
17123
|
} catch (loginError) {
|
|
16818
17124
|
verboseLog("Login failed:", {
|
|
@@ -16868,7 +17174,7 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16868
17174
|
message: error.message
|
|
16869
17175
|
});
|
|
16870
17176
|
}
|
|
16871
|
-
const { resolveAskProject } = await import("./resolveAskProject-
|
|
17177
|
+
const { resolveAskProject } = await import("./resolveAskProject-XM4W4DON.js");
|
|
16872
17178
|
let project;
|
|
16873
17179
|
try {
|
|
16874
17180
|
project = await resolveAskProject({
|
|
@@ -16906,15 +17212,21 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16906
17212
|
const emittedProgressKeys = /* @__PURE__ */ new Set();
|
|
16907
17213
|
if (options.debug) {
|
|
16908
17214
|
console.error(`[${commandName}] Question: ${question}`);
|
|
16909
|
-
console.error(
|
|
17215
|
+
console.error(
|
|
17216
|
+
`[${commandName}] Project: ${project.id} (${project.name})`
|
|
17217
|
+
);
|
|
16910
17218
|
console.error(`[${commandName}] Thread ID: ${threadId}`);
|
|
16911
17219
|
}
|
|
16912
17220
|
if (streamTextOutput && options.output) {
|
|
16913
|
-
fileOutputStream = fs14.createWriteStream(options.output, {
|
|
17221
|
+
fileOutputStream = fs14.createWriteStream(options.output, {
|
|
17222
|
+
encoding: "utf-8"
|
|
17223
|
+
});
|
|
16914
17224
|
outputStream = fileOutputStream;
|
|
16915
17225
|
}
|
|
16916
17226
|
if (ndjsonOutput && options.output) {
|
|
16917
|
-
ndjsonOutputStream = fs14.createWriteStream(options.output, {
|
|
17227
|
+
ndjsonOutputStream = fs14.createWriteStream(options.output, {
|
|
17228
|
+
encoding: "utf-8"
|
|
17229
|
+
});
|
|
16918
17230
|
}
|
|
16919
17231
|
const writeAskDataEvent = (event) => {
|
|
16920
17232
|
const line = `${JSON.stringify(event)}
|
|
@@ -16942,12 +17254,9 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16942
17254
|
if (!event) {
|
|
16943
17255
|
return;
|
|
16944
17256
|
}
|
|
16945
|
-
const key = [
|
|
16946
|
-
|
|
16947
|
-
|
|
16948
|
-
event.status,
|
|
16949
|
-
event.message
|
|
16950
|
-
].join(":");
|
|
17257
|
+
const key = [event.type, event.step, event.status, event.message].join(
|
|
17258
|
+
":"
|
|
17259
|
+
);
|
|
16951
17260
|
if (emittedProgressKeys.has(key)) {
|
|
16952
17261
|
return;
|
|
16953
17262
|
}
|
|
@@ -16972,7 +17281,7 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16972
17281
|
});
|
|
16973
17282
|
const logHeaders = {
|
|
16974
17283
|
"Content-Type": "application/json",
|
|
16975
|
-
|
|
17284
|
+
Accept: "text/event-stream"
|
|
16976
17285
|
};
|
|
16977
17286
|
if (token) {
|
|
16978
17287
|
logHeaders["Authorization"] = `Bearer [REDACTED]`;
|
|
@@ -17010,7 +17319,10 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
17010
17319
|
authToken: token,
|
|
17011
17320
|
message: hitlResume ? "" : question,
|
|
17012
17321
|
threadId,
|
|
17013
|
-
user: {
|
|
17322
|
+
user: {
|
|
17323
|
+
id: project.user_id ?? authenticatedUserId ?? "cli-user",
|
|
17324
|
+
name: userName
|
|
17325
|
+
},
|
|
17014
17326
|
project,
|
|
17015
17327
|
settings: streamSettings,
|
|
17016
17328
|
debug: options.debug,
|
|
@@ -17032,7 +17344,9 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
17032
17344
|
});
|
|
17033
17345
|
}
|
|
17034
17346
|
chatState = reduceChunk(chatState, chunk);
|
|
17035
|
-
writeChunkProgressEvent(
|
|
17347
|
+
writeChunkProgressEvent(
|
|
17348
|
+
progressEventFromChunk(chunk, { verbose: options.verbose })
|
|
17349
|
+
);
|
|
17036
17350
|
if (chunk.type === "hitl_request") {
|
|
17037
17351
|
pendingHitlRequest = chunk;
|
|
17038
17352
|
if (ndjsonOutput) {
|
|
@@ -17081,7 +17395,11 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
17081
17395
|
if (jsonOutput) {
|
|
17082
17396
|
responseText = `Error: ${errorMsg}`;
|
|
17083
17397
|
} else if (ndjsonOutput) {
|
|
17084
|
-
writeAskDataEvent({
|
|
17398
|
+
writeAskDataEvent({
|
|
17399
|
+
type: "error",
|
|
17400
|
+
error: { message: errorMsg },
|
|
17401
|
+
threadId
|
|
17402
|
+
});
|
|
17085
17403
|
} else {
|
|
17086
17404
|
outputStream.write(`
|
|
17087
17405
|
Error: ${errorMsg}
|
|
@@ -17094,7 +17412,9 @@ Error: ${errorMsg}
|
|
|
17094
17412
|
} catch (error) {
|
|
17095
17413
|
if (!providedAccessKey && !retriedAfterAuthRefresh && isExpiredDeviceTokenStreamError(error)) {
|
|
17096
17414
|
retriedAfterAuthRefresh = true;
|
|
17097
|
-
verboseLog(
|
|
17415
|
+
verboseLog(
|
|
17416
|
+
"Stored device token expired during stream; refreshing and retrying once"
|
|
17417
|
+
);
|
|
17098
17418
|
progressWriter.write({
|
|
17099
17419
|
type: "auth",
|
|
17100
17420
|
step: "auth",
|
|
@@ -17124,7 +17444,11 @@ Error: ${errorMsg}
|
|
|
17124
17444
|
questions
|
|
17125
17445
|
};
|
|
17126
17446
|
const message = "Human input required by CloudEval.";
|
|
17127
|
-
const summary = summarizeHitlRequest({
|
|
17447
|
+
const summary = summarizeHitlRequest({
|
|
17448
|
+
questions,
|
|
17449
|
+
checkpointId,
|
|
17450
|
+
frontendUrl
|
|
17451
|
+
});
|
|
17128
17452
|
if (jsonOutput) {
|
|
17129
17453
|
const output = {
|
|
17130
17454
|
ok: false,
|
|
@@ -17153,7 +17477,11 @@ Error: ${errorMsg}
|
|
|
17153
17477
|
ok: false,
|
|
17154
17478
|
command: commandName,
|
|
17155
17479
|
error: { code: "HITL_REQUIRED", message },
|
|
17156
|
-
data: {
|
|
17480
|
+
data: {
|
|
17481
|
+
threadId: chatState.threadId,
|
|
17482
|
+
project: { id: project.id, name: project.name },
|
|
17483
|
+
hitl
|
|
17484
|
+
},
|
|
17157
17485
|
frontendUrl
|
|
17158
17486
|
});
|
|
17159
17487
|
await closeOutputStream();
|
|
@@ -17185,7 +17513,11 @@ Error: ${errorMsg}
|
|
|
17185
17513
|
if (jsonOutput) {
|
|
17186
17514
|
responseText = `Error: ${errorMsg}`;
|
|
17187
17515
|
} else if (ndjsonOutput) {
|
|
17188
|
-
writeAskDataEvent({
|
|
17516
|
+
writeAskDataEvent({
|
|
17517
|
+
type: "error",
|
|
17518
|
+
error: { message: errorMsg },
|
|
17519
|
+
threadId
|
|
17520
|
+
});
|
|
17189
17521
|
} else {
|
|
17190
17522
|
outputStream.write(`
|
|
17191
17523
|
Error: ${errorMsg}
|
|
@@ -17386,7 +17718,7 @@ Error: ${errorMsg}
|
|
|
17386
17718
|
program.command("banner").description("Preview the startup banner and terminal capabilities").action(async () => {
|
|
17387
17719
|
const { render } = await import("ink");
|
|
17388
17720
|
const BannerPreview = React.lazy(async () => ({
|
|
17389
|
-
default: (await import("./Banner-
|
|
17721
|
+
default: (await import("./Banner-XDSXKCKM.js")).Banner
|
|
17390
17722
|
}));
|
|
17391
17723
|
render(
|
|
17392
17724
|
/* @__PURE__ */ jsx(React.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(BannerPreview, { disable: false }) })
|