@ganakailabs/cloudeval-cli 0.29.4 → 0.30.1
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-IRVY4LSK.js} +6 -6
- package/dist/{Banner-QGOVG5CQ.js → Banner-4PWF5O3B.js} +2 -2
- package/dist/{Onboarding-HCORVZMZ.js → Onboarding-ZHKPXN5Z.js} +2 -2
- package/dist/{chunk-ERGQHMNT.js → chunk-NXM4JEOB.js} +108 -35
- package/dist/{chunk-XZIBSJA4.js → chunk-P5JXFRYX.js} +1 -1
- package/dist/{chunk-LEWFJSYP.js → chunk-STE265DV.js} +1 -1
- package/dist/{chunk-4OE4CRKD.js → chunk-VRO5RWBC.js} +1 -1
- package/dist/cli.js +668 -351
- 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-STE265DV.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,31 @@ 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 = [
|
|
1771
|
-
|
|
1801
|
+
var outputFormats = [
|
|
1802
|
+
"tui",
|
|
1803
|
+
"summary",
|
|
1804
|
+
"text",
|
|
1805
|
+
"json",
|
|
1806
|
+
"ndjson",
|
|
1807
|
+
"markdown",
|
|
1808
|
+
"table"
|
|
1809
|
+
];
|
|
1810
|
+
var addCommonOptions = (command, defaultBaseUrl, formatHelpOptions = outputFormats) => 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(
|
|
1819
|
+
"--format <format>",
|
|
1820
|
+
`Output format: ${formatHelpOptions.join(", ")}`
|
|
1821
|
+
).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(
|
|
1822
|
+
"--non-interactive",
|
|
1823
|
+
"Disable prompts and browser login",
|
|
1824
|
+
false
|
|
1825
|
+
);
|
|
1776
1826
|
var resolveMode = (options) => {
|
|
1777
1827
|
if (options.raw) return "raw";
|
|
1778
1828
|
if (options.parsed) return "parsed";
|
|
@@ -1783,7 +1833,9 @@ var resolveFormat = (requested, tuiDefault) => {
|
|
|
1783
1833
|
return requested;
|
|
1784
1834
|
}
|
|
1785
1835
|
if (requested) {
|
|
1786
|
-
throw new Error(
|
|
1836
|
+
throw new Error(
|
|
1837
|
+
`Unsupported format '${requested}'. Use ${outputFormats.join(", ")}.`
|
|
1838
|
+
);
|
|
1787
1839
|
}
|
|
1788
1840
|
return tuiDefault && process.stdout.isTTY && !process.env.CI ? "tui" : "summary";
|
|
1789
1841
|
};
|
|
@@ -1795,7 +1847,7 @@ var resolveToken = async (options, baseUrl, deps, command) => {
|
|
|
1795
1847
|
if (options.accessKey) {
|
|
1796
1848
|
return options.accessKey;
|
|
1797
1849
|
}
|
|
1798
|
-
const { getAuthToken } = await import("./dist-
|
|
1850
|
+
const { getAuthToken } = await import("./dist-6LEMVXIY.js");
|
|
1799
1851
|
try {
|
|
1800
1852
|
return await getAuthToken({
|
|
1801
1853
|
accessKey: options.accessKey,
|
|
@@ -1806,10 +1858,12 @@ var resolveToken = async (options, baseUrl, deps, command) => {
|
|
|
1806
1858
|
if (!canLogin) {
|
|
1807
1859
|
throw error;
|
|
1808
1860
|
}
|
|
1809
|
-
const { login } = await import("./dist-
|
|
1861
|
+
const { login } = await import("./dist-6LEMVXIY.js");
|
|
1810
1862
|
process.stderr.write("Authentication required. Starting login flow...\n");
|
|
1811
1863
|
const token = await login(baseUrl, {
|
|
1812
|
-
headless: Boolean(
|
|
1864
|
+
headless: Boolean(
|
|
1865
|
+
process.env.SSH_TTY || process.env.CLOUDEVAL_HEADLESS_LOGIN
|
|
1866
|
+
)
|
|
1813
1867
|
});
|
|
1814
1868
|
process.stderr.write("Authentication successful.\n");
|
|
1815
1869
|
return token;
|
|
@@ -1844,14 +1898,19 @@ var writeReport = async (report, options, tuiDefault) => {
|
|
|
1844
1898
|
import("ink"),
|
|
1845
1899
|
import("./ReportDashboard-DOAUB727.js")
|
|
1846
1900
|
]);
|
|
1847
|
-
render(
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1901
|
+
render(
|
|
1902
|
+
React2.createElement(ReportDashboard, {
|
|
1903
|
+
report,
|
|
1904
|
+
initialMode: mode === "formatted" ? "overview" : mode
|
|
1905
|
+
})
|
|
1906
|
+
);
|
|
1851
1907
|
return;
|
|
1852
1908
|
}
|
|
1853
1909
|
const textFormat = format === "text" || format === "table" ? "summary" : format;
|
|
1854
|
-
const text = serializeReportOutput(report, {
|
|
1910
|
+
const text = serializeReportOutput(report, {
|
|
1911
|
+
format: textFormat,
|
|
1912
|
+
mode
|
|
1913
|
+
});
|
|
1855
1914
|
if (options.output) {
|
|
1856
1915
|
const fs14 = await import("fs/promises");
|
|
1857
1916
|
await fs14.writeFile(options.output, text, "utf8");
|
|
@@ -1877,6 +1936,34 @@ var pickReportDownloadPayload = (value, view) => {
|
|
|
1877
1936
|
}
|
|
1878
1937
|
return value;
|
|
1879
1938
|
};
|
|
1939
|
+
var normalizeReportPdfVerbosity = (value) => {
|
|
1940
|
+
if (value === "brief" || value === "detailed" || value === "evidence") {
|
|
1941
|
+
return value;
|
|
1942
|
+
}
|
|
1943
|
+
if (value === "short") return "brief";
|
|
1944
|
+
if (value === "full" || value === "extended") return "evidence";
|
|
1945
|
+
return "detailed";
|
|
1946
|
+
};
|
|
1947
|
+
var mapReportTypeForPdf = (value) => {
|
|
1948
|
+
if (value === "cost") return "cost";
|
|
1949
|
+
if (value === "waf" || value === "architecture") return "architecture";
|
|
1950
|
+
if (value === "unit-tests" || value === "unit_tests") return "unit_tests";
|
|
1951
|
+
return "all";
|
|
1952
|
+
};
|
|
1953
|
+
var resolvePdfOutputPath = async (requestedOutput, filename) => {
|
|
1954
|
+
const path11 = await import("path");
|
|
1955
|
+
if (!requestedOutput) {
|
|
1956
|
+
return path11.resolve(filename);
|
|
1957
|
+
}
|
|
1958
|
+
const fs14 = await import("fs/promises");
|
|
1959
|
+
const stat = await fs14.stat(requestedOutput).catch(() => void 0);
|
|
1960
|
+
if (stat?.isDirectory() || !path11.extname(requestedOutput)) {
|
|
1961
|
+
await fs14.mkdir(requestedOutput, { recursive: true });
|
|
1962
|
+
return path11.join(requestedOutput, filename);
|
|
1963
|
+
}
|
|
1964
|
+
await fs14.mkdir(path11.dirname(requestedOutput), { recursive: true });
|
|
1965
|
+
return requestedOutput;
|
|
1966
|
+
};
|
|
1880
1967
|
var writeDownloadPayload = async (input) => {
|
|
1881
1968
|
if (!input.output) {
|
|
1882
1969
|
process.stdout.write(
|
|
@@ -1908,7 +1995,9 @@ var resolveMachineFormat = (requested) => {
|
|
|
1908
1995
|
if (requested === "text" || requested === "json" || requested === "ndjson" || requested === "markdown") {
|
|
1909
1996
|
return requested;
|
|
1910
1997
|
}
|
|
1911
|
-
throw new Error(
|
|
1998
|
+
throw new Error(
|
|
1999
|
+
"Unsupported format for reports run. Use text, json, ndjson, or markdown."
|
|
2000
|
+
);
|
|
1912
2001
|
};
|
|
1913
2002
|
var extractJobId = (value) => {
|
|
1914
2003
|
if (!value || typeof value !== "object") return void 0;
|
|
@@ -1917,8 +2006,17 @@ var extractJobId = (value) => {
|
|
|
1917
2006
|
};
|
|
1918
2007
|
var isTerminalJobStatus = (value) => {
|
|
1919
2008
|
if (!value || typeof value !== "object") return true;
|
|
1920
|
-
const status = String(
|
|
1921
|
-
|
|
2009
|
+
const status = String(
|
|
2010
|
+
value.status ?? ""
|
|
2011
|
+
).toLowerCase();
|
|
2012
|
+
return [
|
|
2013
|
+
"completed",
|
|
2014
|
+
"succeeded",
|
|
2015
|
+
"failed",
|
|
2016
|
+
"error",
|
|
2017
|
+
"cancelled",
|
|
2018
|
+
"canceled"
|
|
2019
|
+
].includes(status);
|
|
1922
2020
|
};
|
|
1923
2021
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1924
2022
|
var waitForReportJobs = async ({
|
|
@@ -1963,141 +2061,219 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
1963
2061
|
addCommonOptions(
|
|
1964
2062
|
reports.command("list").description("List available reports"),
|
|
1965
2063
|
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
|
-
|
|
2064
|
+
).option("--kind <kind>", "Filter by kind: cost, waf, all", "all").action(
|
|
2065
|
+
async (options, command) => {
|
|
2066
|
+
try {
|
|
2067
|
+
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
2068
|
+
const token = await resolveToken(options, baseUrl, deps, command);
|
|
2069
|
+
const projectId = await resolveReportProjectId({
|
|
2070
|
+
baseUrl,
|
|
2071
|
+
token,
|
|
2072
|
+
requestedProjectId: options.project
|
|
2073
|
+
});
|
|
2074
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2075
|
+
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2076
|
+
const reports2 = await core.listReports({
|
|
2077
|
+
baseUrl,
|
|
2078
|
+
authToken: token,
|
|
2079
|
+
projectId,
|
|
2080
|
+
kind: options.kind,
|
|
2081
|
+
userId: status?.user?.id
|
|
2082
|
+
});
|
|
2083
|
+
writeReportList(reports2, options.format);
|
|
2084
|
+
} catch (error) {
|
|
2085
|
+
console.error(
|
|
2086
|
+
`\u274C Failed to list reports: ${error?.message ?? "Unknown error"}`
|
|
2087
|
+
);
|
|
2088
|
+
process.exit(1);
|
|
2089
|
+
}
|
|
1988
2090
|
}
|
|
1989
|
-
|
|
2091
|
+
);
|
|
1990
2092
|
addCommonOptions(
|
|
1991
2093
|
reports.command("download").description("Download report JSON or markdown locally"),
|
|
1992
|
-
deps.defaultBaseUrl
|
|
1993
|
-
|
|
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
|
-
|
|
2094
|
+
deps.defaultBaseUrl,
|
|
2095
|
+
[...outputFormats, "pdf"]
|
|
2096
|
+
).option(
|
|
2097
|
+
"--type <type>",
|
|
2098
|
+
"Report type: cost, waf, architecture, unit-tests, all",
|
|
2099
|
+
"all"
|
|
2100
|
+
).option("--view <view>", "Payload view: raw, parsed, formatted", "raw").option("--timestamp <timestamp>", "Historical timestamp").option(
|
|
2101
|
+
"--report-verbosity <verbosity>",
|
|
2102
|
+
"PDF report depth: brief, detailed, evidence",
|
|
2103
|
+
"detailed"
|
|
2104
|
+
).action(
|
|
2105
|
+
async (options, command) => {
|
|
2106
|
+
try {
|
|
2107
|
+
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
2108
|
+
const token = await resolveToken(options, baseUrl, deps, command);
|
|
2109
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2110
|
+
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2111
|
+
const projectId = await resolveReportProjectId({
|
|
2112
|
+
baseUrl,
|
|
2113
|
+
token,
|
|
2114
|
+
requestedProjectId: options.project
|
|
2115
|
+
});
|
|
2116
|
+
if (options.format === "pdf") {
|
|
2117
|
+
if (options.timestamp) {
|
|
2118
|
+
throw new Error(
|
|
2119
|
+
"PDF download currently supports the latest report only."
|
|
2120
|
+
);
|
|
2121
|
+
}
|
|
2122
|
+
const verbosity = normalizeReportPdfVerbosity(
|
|
2123
|
+
options.reportVerbosity
|
|
2124
|
+
);
|
|
2125
|
+
const pdf = await core.downloadReportPdf({
|
|
2023
2126
|
baseUrl,
|
|
2024
2127
|
authToken: token,
|
|
2025
2128
|
projectId,
|
|
2026
2129
|
userId: status?.user?.id,
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
authToken: token,
|
|
2031
|
-
projectId,
|
|
2032
|
-
userId: status?.user?.id
|
|
2130
|
+
verbosity,
|
|
2131
|
+
reportType: mapReportTypeForPdf(options.type),
|
|
2132
|
+
includeVisuals: true
|
|
2033
2133
|
});
|
|
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
|
-
);
|
|
2134
|
+
if (!pdf.bytes.length) {
|
|
2135
|
+
throw new Error("Backend returned an empty PDF.");
|
|
2067
2136
|
}
|
|
2137
|
+
const fs14 = await import("fs/promises");
|
|
2138
|
+
const outputPath = await resolvePdfOutputPath(
|
|
2139
|
+
options.output,
|
|
2140
|
+
pdf.filename
|
|
2141
|
+
);
|
|
2142
|
+
await fs14.writeFile(outputPath, pdf.bytes);
|
|
2068
2143
|
await writeFormattedOutput({
|
|
2069
2144
|
command: "reports download",
|
|
2070
|
-
data: {
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2145
|
+
data: {
|
|
2146
|
+
projectId,
|
|
2147
|
+
file: outputPath,
|
|
2148
|
+
format: "pdf",
|
|
2149
|
+
reportVerbosity: verbosity,
|
|
2150
|
+
status: pdf.status ?? "unknown",
|
|
2151
|
+
warningsCount: pdf.warningsCount ?? 0,
|
|
2152
|
+
bytes: pdf.bytes.length
|
|
2153
|
+
},
|
|
2154
|
+
format: "json",
|
|
2155
|
+
frontendUrl: frontendUrlForReports(baseUrl, options, projectId),
|
|
2156
|
+
filesWritten: [outputPath]
|
|
2074
2157
|
});
|
|
2075
|
-
await maybeOpenReportUrl(frontendUrl, options);
|
|
2076
2158
|
return;
|
|
2077
2159
|
}
|
|
2160
|
+
const reportTypes = options.type === "all" ? ["cost", "waf"] : [options.type || "cost"];
|
|
2161
|
+
const payload = {};
|
|
2162
|
+
for (const type of reportTypes) {
|
|
2163
|
+
if (type === "cost") {
|
|
2164
|
+
const data2 = options.timestamp ? await core.getCostReportHistory({
|
|
2165
|
+
baseUrl,
|
|
2166
|
+
authToken: token,
|
|
2167
|
+
projectId,
|
|
2168
|
+
userId: status?.user?.id,
|
|
2169
|
+
timestamp: options.timestamp
|
|
2170
|
+
}) : await core.getCostReportFull({
|
|
2171
|
+
baseUrl,
|
|
2172
|
+
authToken: token,
|
|
2173
|
+
projectId,
|
|
2174
|
+
userId: status?.user?.id
|
|
2175
|
+
});
|
|
2176
|
+
payload.cost = pickReportDownloadPayload(
|
|
2177
|
+
data2,
|
|
2178
|
+
options.view ?? "raw"
|
|
2179
|
+
);
|
|
2180
|
+
} else if (type === "waf" || type === "architecture") {
|
|
2181
|
+
const data2 = options.timestamp ? await core.getWafReportHistory({
|
|
2182
|
+
baseUrl,
|
|
2183
|
+
authToken: token,
|
|
2184
|
+
projectId,
|
|
2185
|
+
userId: status?.user?.id,
|
|
2186
|
+
timestamp: options.timestamp
|
|
2187
|
+
}) : await core.getWafReportFull({
|
|
2188
|
+
baseUrl,
|
|
2189
|
+
authToken: token,
|
|
2190
|
+
projectId,
|
|
2191
|
+
userId: status?.user?.id
|
|
2192
|
+
});
|
|
2193
|
+
payload.waf = pickReportDownloadPayload(
|
|
2194
|
+
data2,
|
|
2195
|
+
options.view ?? "raw"
|
|
2196
|
+
);
|
|
2197
|
+
} else {
|
|
2198
|
+
throw new Error(`Unsupported report type '${type}'.`);
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
const frontendUrl = frontendUrlForReports(
|
|
2202
|
+
baseUrl,
|
|
2203
|
+
{
|
|
2204
|
+
...options,
|
|
2205
|
+
tab: options.type === "cost" ? "cost" : options.type === "waf" ? "architecture" : "overview",
|
|
2206
|
+
reportType: options.type === "all" ? "all" : options.type
|
|
2207
|
+
},
|
|
2208
|
+
projectId
|
|
2209
|
+
);
|
|
2210
|
+
const data = reportTypes.length === 1 ? payload[reportTypes[0] === "architecture" ? "waf" : reportTypes[0]] : payload;
|
|
2211
|
+
if (options.output && reportTypes.length > 1) {
|
|
2212
|
+
const fs14 = await import("fs/promises");
|
|
2213
|
+
const path11 = await import("path");
|
|
2214
|
+
const stat = await fs14.stat(options.output).catch(() => void 0);
|
|
2215
|
+
if (stat?.isDirectory() || !path11.extname(options.output)) {
|
|
2216
|
+
await fs14.mkdir(options.output, { recursive: true });
|
|
2217
|
+
const files = [];
|
|
2218
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
2219
|
+
const file = path11.join(
|
|
2220
|
+
options.output,
|
|
2221
|
+
`${projectId}-${key}-report.json`
|
|
2222
|
+
);
|
|
2223
|
+
files.push(
|
|
2224
|
+
...await writeDownloadPayload({
|
|
2225
|
+
command: "reports download",
|
|
2226
|
+
payload: value,
|
|
2227
|
+
format: "json",
|
|
2228
|
+
output: file,
|
|
2229
|
+
frontendUrl
|
|
2230
|
+
})
|
|
2231
|
+
);
|
|
2232
|
+
}
|
|
2233
|
+
await writeFormattedOutput({
|
|
2234
|
+
command: "reports download",
|
|
2235
|
+
data: { projectId, filesWritten: files },
|
|
2236
|
+
format: options.format === "json" ? "json" : "text",
|
|
2237
|
+
frontendUrl,
|
|
2238
|
+
filesWritten: files
|
|
2239
|
+
});
|
|
2240
|
+
await maybeOpenReportUrl(frontendUrl, options);
|
|
2241
|
+
return;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
await writeDownloadPayload({
|
|
2245
|
+
command: "reports download",
|
|
2246
|
+
payload: data,
|
|
2247
|
+
format: options.format === "markdown" ? "markdown" : "json",
|
|
2248
|
+
output: options.output,
|
|
2249
|
+
frontendUrl
|
|
2250
|
+
});
|
|
2251
|
+
await maybeOpenReportUrl(frontendUrl, options);
|
|
2252
|
+
} catch (error) {
|
|
2253
|
+
console.error(
|
|
2254
|
+
`Failed to download reports: ${error?.message ?? "Unknown error"}`
|
|
2255
|
+
);
|
|
2256
|
+
process.exit(1);
|
|
2078
2257
|
}
|
|
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
2258
|
}
|
|
2091
|
-
|
|
2259
|
+
);
|
|
2092
2260
|
addCommonOptions(
|
|
2093
2261
|
reports.command("run").description("Run report generation for a project"),
|
|
2094
2262
|
deps.defaultBaseUrl
|
|
2095
|
-
).option(
|
|
2263
|
+
).option(
|
|
2264
|
+
"--type <type>",
|
|
2265
|
+
"Report type: cost, waf, architecture, unit-tests, all",
|
|
2266
|
+
"all"
|
|
2267
|
+
).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(
|
|
2268
|
+
"--poll-interval <ms>",
|
|
2269
|
+
"Polling interval when --wait is set",
|
|
2270
|
+
"2500"
|
|
2271
|
+
).action(
|
|
2096
2272
|
async (options, command) => {
|
|
2097
2273
|
try {
|
|
2098
2274
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
2099
2275
|
const token = await resolveToken(options, baseUrl, deps, command);
|
|
2100
|
-
const core = await import("./dist-
|
|
2276
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2101
2277
|
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2102
2278
|
const projectId = await resolveReportProjectId({
|
|
2103
2279
|
baseUrl,
|
|
@@ -2114,8 +2290,10 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2114
2290
|
},
|
|
2115
2291
|
projectId
|
|
2116
2292
|
);
|
|
2117
|
-
process.stderr.write(
|
|
2118
|
-
`
|
|
2293
|
+
process.stderr.write(
|
|
2294
|
+
`Submitting ${requestedType} report run for project ${projectId}...
|
|
2295
|
+
`
|
|
2296
|
+
);
|
|
2119
2297
|
const submitted = await core.runReports({
|
|
2120
2298
|
baseUrl,
|
|
2121
2299
|
authToken: token,
|
|
@@ -2133,7 +2311,10 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2133
2311
|
token,
|
|
2134
2312
|
userId: status?.user?.id,
|
|
2135
2313
|
submitted,
|
|
2136
|
-
pollInterval: Math.max(
|
|
2314
|
+
pollInterval: Math.max(
|
|
2315
|
+
500,
|
|
2316
|
+
Number(options.pollInterval) || 2500
|
|
2317
|
+
)
|
|
2137
2318
|
}) : void 0;
|
|
2138
2319
|
await writeFormattedOutput({
|
|
2139
2320
|
command: "reports run",
|
|
@@ -2150,7 +2331,9 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2150
2331
|
});
|
|
2151
2332
|
await maybeOpenReportUrl(frontendUrl, options);
|
|
2152
2333
|
} catch (error) {
|
|
2153
|
-
console.error(
|
|
2334
|
+
console.error(
|
|
2335
|
+
`Failed to run reports: ${error?.message ?? "Unknown error"}`
|
|
2336
|
+
);
|
|
2154
2337
|
process.exit(1);
|
|
2155
2338
|
}
|
|
2156
2339
|
}
|
|
@@ -2158,42 +2341,46 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2158
2341
|
addCommonOptions(
|
|
2159
2342
|
reports.command("rules").description("Show Well-Architected Framework rules"),
|
|
2160
2343
|
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(
|
|
2344
|
+
).option("--type <type>", "Rule report type: waf", "waf").action(
|
|
2345
|
+
async (options, command) => {
|
|
2346
|
+
try {
|
|
2347
|
+
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
2348
|
+
const token = await resolveToken(options, baseUrl, deps, command);
|
|
2349
|
+
const projectId = await resolveReportProjectId({
|
|
2187
2350
|
baseUrl,
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
)
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2351
|
+
token,
|
|
2352
|
+
requestedProjectId: options.project
|
|
2353
|
+
});
|
|
2354
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2355
|
+
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2356
|
+
const report = await core.getWafReport({
|
|
2357
|
+
baseUrl,
|
|
2358
|
+
authToken: token,
|
|
2359
|
+
projectId,
|
|
2360
|
+
view: "rules",
|
|
2361
|
+
userId: status?.user?.id
|
|
2362
|
+
});
|
|
2363
|
+
const payload = selectReportModePayload(report, resolveMode(options));
|
|
2364
|
+
const rules = payload?.rules ?? report.parsed?.rules ?? report.raw?.rules ?? report.raw?.ruleResults ?? [];
|
|
2365
|
+
await writeFormattedOutput({
|
|
2366
|
+
command: "reports rules",
|
|
2367
|
+
data: rules,
|
|
2368
|
+
format: options.format === "json" || options.format === "ndjson" || options.format === "markdown" ? options.format : "text",
|
|
2369
|
+
output: options.output,
|
|
2370
|
+
frontendUrl: frontendUrlForReports(
|
|
2371
|
+
baseUrl,
|
|
2372
|
+
{ ...options, tab: "architecture", reportType: "waf" },
|
|
2373
|
+
projectId
|
|
2374
|
+
)
|
|
2375
|
+
});
|
|
2376
|
+
} catch (error) {
|
|
2377
|
+
console.error(
|
|
2378
|
+
`Failed to show report rules: ${error?.message ?? "Unknown error"}`
|
|
2379
|
+
);
|
|
2380
|
+
process.exit(1);
|
|
2381
|
+
}
|
|
2195
2382
|
}
|
|
2196
|
-
|
|
2383
|
+
);
|
|
2197
2384
|
addCommonOptions(
|
|
2198
2385
|
reports.command("show").description("Show a report by id").argument("<report-id>", "Report ID"),
|
|
2199
2386
|
deps.defaultBaseUrl
|
|
@@ -2206,7 +2393,7 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2206
2393
|
token,
|
|
2207
2394
|
requestedProjectId: options.project
|
|
2208
2395
|
});
|
|
2209
|
-
const core = await import("./dist-
|
|
2396
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2210
2397
|
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2211
2398
|
const report = await core.getReport({
|
|
2212
2399
|
baseUrl,
|
|
@@ -2218,42 +2405,58 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2218
2405
|
});
|
|
2219
2406
|
await writeReport(report, options, false);
|
|
2220
2407
|
} catch (error) {
|
|
2221
|
-
console.error(
|
|
2408
|
+
console.error(
|
|
2409
|
+
`\u274C Failed to show report: ${error?.message ?? "Unknown error"}`
|
|
2410
|
+
);
|
|
2222
2411
|
process.exit(1);
|
|
2223
2412
|
}
|
|
2224
2413
|
});
|
|
2225
2414
|
addCommonOptions(
|
|
2226
2415
|
reports.command("cost").description("Show the latest cost report"),
|
|
2227
2416
|
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
|
-
|
|
2417
|
+
).option(
|
|
2418
|
+
"--period <period>",
|
|
2419
|
+
"Report period, for example 7d, 30d, 90d",
|
|
2420
|
+
"30d"
|
|
2421
|
+
).option(
|
|
2422
|
+
"--view <view>",
|
|
2423
|
+
"Cost view: overview, services, recommendations, anomalies, raw"
|
|
2424
|
+
).action(
|
|
2425
|
+
async (options, command) => {
|
|
2426
|
+
try {
|
|
2427
|
+
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
2428
|
+
const token = await resolveToken(options, baseUrl, deps, command);
|
|
2429
|
+
const projectId = await resolveReportProjectId({
|
|
2430
|
+
baseUrl,
|
|
2431
|
+
token,
|
|
2432
|
+
requestedProjectId: options.project
|
|
2433
|
+
});
|
|
2434
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2435
|
+
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2436
|
+
const report = await core.getCostReport({
|
|
2437
|
+
baseUrl,
|
|
2438
|
+
authToken: token,
|
|
2439
|
+
projectId,
|
|
2440
|
+
period: options.period,
|
|
2441
|
+
view: options.view,
|
|
2442
|
+
userId: status?.user?.id
|
|
2443
|
+
});
|
|
2444
|
+
await writeReport(report, options, true);
|
|
2445
|
+
} catch (error) {
|
|
2446
|
+
console.error(
|
|
2447
|
+
`\u274C Failed to show cost report: ${error?.message ?? "Unknown error"}`
|
|
2448
|
+
);
|
|
2449
|
+
process.exit(1);
|
|
2450
|
+
}
|
|
2251
2451
|
}
|
|
2252
|
-
|
|
2452
|
+
);
|
|
2253
2453
|
addCommonOptions(
|
|
2254
2454
|
reports.command("waf").description("Show the latest Well-Architected Framework report"),
|
|
2255
2455
|
deps.defaultBaseUrl
|
|
2256
|
-
).option("--report <id>", "Specific report id").option("--severity <severity>", "Filter by severity").option(
|
|
2456
|
+
).option("--report <id>", "Specific report id").option("--severity <severity>", "Filter by severity").option(
|
|
2457
|
+
"--view <view>",
|
|
2458
|
+
"WAF view: overview, pillars, rules, resources, raw"
|
|
2459
|
+
).action(
|
|
2257
2460
|
async (options, command) => {
|
|
2258
2461
|
try {
|
|
2259
2462
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
@@ -2263,7 +2466,7 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2263
2466
|
token,
|
|
2264
2467
|
requestedProjectId: options.project
|
|
2265
2468
|
});
|
|
2266
|
-
const core = await import("./dist-
|
|
2469
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
2267
2470
|
const status = token ? await core.checkUserStatus(baseUrl, token) : void 0;
|
|
2268
2471
|
const report = await core.getWafReport({
|
|
2269
2472
|
baseUrl,
|
|
@@ -2276,7 +2479,9 @@ var registerReportsCommand = (program2, deps) => {
|
|
|
2276
2479
|
});
|
|
2277
2480
|
await writeReport(report, options, true);
|
|
2278
2481
|
} catch (error) {
|
|
2279
|
-
console.error(
|
|
2482
|
+
console.error(
|
|
2483
|
+
`\u274C Failed to show WAF report: ${error?.message ?? "Unknown error"}`
|
|
2484
|
+
);
|
|
2280
2485
|
process.exit(1);
|
|
2281
2486
|
}
|
|
2282
2487
|
}
|
|
@@ -5269,7 +5474,7 @@ var runChatRecipe = async (recipe, prompt2, options, command, deps) => {
|
|
|
5269
5474
|
});
|
|
5270
5475
|
progressWriter.write({ type: "auth", step: "auth", message: "Resolving authentication" });
|
|
5271
5476
|
const context = await resolveAuthContext(options, command, deps);
|
|
5272
|
-
const core = await import("./dist-
|
|
5477
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
5273
5478
|
progressWriter.write({
|
|
5274
5479
|
type: "request",
|
|
5275
5480
|
step: "project",
|
|
@@ -6833,7 +7038,7 @@ var configureDiagramExportCommand = (command, deps) => addAuthOptions(command, d
|
|
|
6833
7038
|
const context = requireAuthUser(
|
|
6834
7039
|
await resolveAuthContext(options, actionCommand, deps)
|
|
6835
7040
|
);
|
|
6836
|
-
const core = await import("./dist-
|
|
7041
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
6837
7042
|
const projects = await core.getProjects(
|
|
6838
7043
|
context.baseUrl,
|
|
6839
7044
|
context.token,
|
|
@@ -6910,7 +7115,7 @@ var registerProjectsCommand = (program2, deps) => {
|
|
|
6910
7115
|
addCommon(addAuthOptions(projects.command("list").description("List projects"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
6911
7116
|
try {
|
|
6912
7117
|
const context = await resolveAuthContext(options, command, deps);
|
|
6913
|
-
const core = await import("./dist-
|
|
7118
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
6914
7119
|
const data = await listProjectsForContext(core, context);
|
|
6915
7120
|
const url = buildFrontendUrl({ baseUrl: frontendBase(context, options), target: "projects" });
|
|
6916
7121
|
await writeProjectListOutput({ data, options, frontendUrl: url });
|
|
@@ -6928,7 +7133,7 @@ var registerProjectsCommand = (program2, deps) => {
|
|
|
6928
7133
|
).action(async (id, options, command) => {
|
|
6929
7134
|
try {
|
|
6930
7135
|
const context = await resolveAuthContext(options, command, deps);
|
|
6931
|
-
const core = await import("./dist-
|
|
7136
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
6932
7137
|
const list = await listProjectsForContext(core, context);
|
|
6933
7138
|
const data = list.find((project) => project.id === id);
|
|
6934
7139
|
if (!data) {
|
|
@@ -6997,7 +7202,7 @@ var registerProjectsCommand = (program2, deps) => {
|
|
|
6997
7202
|
try {
|
|
6998
7203
|
assertSingleProjectSource(options);
|
|
6999
7204
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7000
|
-
const core = await import("./dist-
|
|
7205
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7001
7206
|
const template = await fileBlob(options.templateFile);
|
|
7002
7207
|
const parameters = await fileBlob(options.parametersFile);
|
|
7003
7208
|
const workspace = options.workspaceDir ? await collectWorkspaceFiles(options.workspaceDir, options) : void 0;
|
|
@@ -7122,7 +7327,7 @@ var registerIssuesInventoryCommand = (program2, deps) => {
|
|
|
7122
7327
|
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
7328
|
try {
|
|
7124
7329
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7125
|
-
const core = await import("./dist-
|
|
7330
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7126
7331
|
const data = await core.listIssuesItems({
|
|
7127
7332
|
baseUrl: context.baseUrl,
|
|
7128
7333
|
authToken: context.token,
|
|
@@ -7170,7 +7375,7 @@ var registerIssuesInventoryCommand = (program2, deps) => {
|
|
|
7170
7375
|
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
7376
|
try {
|
|
7172
7377
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7173
|
-
const core = await import("./dist-
|
|
7378
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7174
7379
|
const data = await core.getIssuesItem({
|
|
7175
7380
|
baseUrl: context.baseUrl,
|
|
7176
7381
|
authToken: context.token,
|
|
@@ -7291,7 +7496,7 @@ var registerConnectionsCommand = (program2, deps) => {
|
|
|
7291
7496
|
addCommon3(addAuthOptions(connections.command("list").description("List connections"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
7292
7497
|
try {
|
|
7293
7498
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7294
|
-
const core = await import("./dist-
|
|
7499
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7295
7500
|
const data = await core.listConnections({
|
|
7296
7501
|
baseUrl: context.baseUrl,
|
|
7297
7502
|
authToken: context.token,
|
|
@@ -7316,7 +7521,7 @@ var registerConnectionsCommand = (program2, deps) => {
|
|
|
7316
7521
|
).action(async (id, options, command) => {
|
|
7317
7522
|
try {
|
|
7318
7523
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7319
|
-
const core = await import("./dist-
|
|
7524
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7320
7525
|
const data = await core.getConnection({
|
|
7321
7526
|
baseUrl: context.baseUrl,
|
|
7322
7527
|
authToken: context.token,
|
|
@@ -7653,7 +7858,7 @@ var checkoutReturnUrl = (context, options) => options.returnTo || billingUrl(con
|
|
|
7653
7858
|
var runTopUpCheckout = async (commandName, packId, options, command, deps) => {
|
|
7654
7859
|
try {
|
|
7655
7860
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7656
|
-
const core = await import("./dist-
|
|
7861
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7657
7862
|
const returnTo = checkoutReturnUrl(context, options);
|
|
7658
7863
|
const session = await core.createTopUpCheckoutSession({
|
|
7659
7864
|
baseUrl: context.baseUrl,
|
|
@@ -7693,7 +7898,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7693
7898
|
).action(async (options, command) => {
|
|
7694
7899
|
try {
|
|
7695
7900
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7696
|
-
const core = await import("./dist-
|
|
7901
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7697
7902
|
const range = rangeToDates("30d");
|
|
7698
7903
|
const [entitlement, usageSummary] = await Promise.all([
|
|
7699
7904
|
core.getBillingEntitlement({
|
|
@@ -7723,7 +7928,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7723
7928
|
addCommon4(addAuthOptions(billing.command("summary").description("Show billing summary"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
7724
7929
|
try {
|
|
7725
7930
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7726
|
-
const core = await import("./dist-
|
|
7931
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7727
7932
|
const range = rangeToDates("30d");
|
|
7728
7933
|
const [entitlement, subscriptionStatus, usageSummary] = await Promise.all([
|
|
7729
7934
|
core.getBillingEntitlement({ baseUrl: context.baseUrl, authToken: context.token }),
|
|
@@ -7759,7 +7964,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7759
7964
|
addCommon4(addAuthOptions(billing.command("plans").description("Show billing plans"), deps.defaultBaseUrl)).action(async (options, command) => {
|
|
7760
7965
|
try {
|
|
7761
7966
|
const context = await resolveAuthContext(options, command, deps);
|
|
7762
|
-
const core = await import("./dist-
|
|
7967
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7763
7968
|
const data = await core.getBillingConfig({ baseUrl: context.baseUrl, authToken: context.token });
|
|
7764
7969
|
const url = billingUrl(context, { ...options, tab: "plans" });
|
|
7765
7970
|
await write("billing plans", data, options, url);
|
|
@@ -7771,7 +7976,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7771
7976
|
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
7977
|
try {
|
|
7773
7978
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7774
|
-
const core = await import("./dist-
|
|
7979
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7775
7980
|
const range = rangeToDates(options.range);
|
|
7776
7981
|
const data = await core.getBillingUsageSummary({
|
|
7777
7982
|
baseUrl: context.baseUrl,
|
|
@@ -7794,7 +7999,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7794
7999
|
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
8000
|
try {
|
|
7796
8001
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7797
|
-
const core = await import("./dist-
|
|
8002
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7798
8003
|
const range = rangeToDates(options.range);
|
|
7799
8004
|
const data = await core.getBillingUsageLedger({
|
|
7800
8005
|
baseUrl: context.baseUrl,
|
|
@@ -7822,7 +8027,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7822
8027
|
addCommon4(addAuthOptions(billing.command(name).description(`Show billing ${name}`), deps.defaultBaseUrl)).option("--limit <n>", "Result limit", "25").action(async (options, command) => {
|
|
7823
8028
|
try {
|
|
7824
8029
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7825
|
-
const core = await import("./dist-
|
|
8030
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7826
8031
|
const data = await core[getter]({
|
|
7827
8032
|
baseUrl: context.baseUrl,
|
|
7828
8033
|
authToken: context.token,
|
|
@@ -7840,7 +8045,7 @@ var registerBillingCommands = (program2, deps) => {
|
|
|
7840
8045
|
addCommon4(addAuthOptions(topups, deps.defaultBaseUrl)).option("--limit <n>", "Result limit", "25").action(async (options, command) => {
|
|
7841
8046
|
try {
|
|
7842
8047
|
const context = requireAuthUser(await resolveAuthContext(options, command, deps));
|
|
7843
|
-
const core = await import("./dist-
|
|
8048
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
7844
8049
|
const data = await core.getTopUpPacks({
|
|
7845
8050
|
baseUrl: context.baseUrl,
|
|
7846
8051
|
authToken: context.token
|
|
@@ -10895,7 +11100,7 @@ var reportsFrontendUrl = (config, input) => buildFrontendUrl({
|
|
|
10895
11100
|
reportVerbosity: input.reportVerbosity
|
|
10896
11101
|
});
|
|
10897
11102
|
var resolveAuth = async (config, options = {}) => {
|
|
10898
|
-
const core = await import("./dist-
|
|
11103
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
10899
11104
|
core.assertSecureBaseUrl(config.baseUrl);
|
|
10900
11105
|
let token;
|
|
10901
11106
|
try {
|
|
@@ -10991,7 +11196,7 @@ var assertModelAvailable = async (config, token) => {
|
|
|
10991
11196
|
if (!config.model) {
|
|
10992
11197
|
return;
|
|
10993
11198
|
}
|
|
10994
|
-
const core = await import("./dist-
|
|
11199
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
10995
11200
|
try {
|
|
10996
11201
|
const response = await fetch(
|
|
10997
11202
|
`${core.normalizeApiBase(config.baseUrl)}/models`,
|
|
@@ -11248,7 +11453,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11248
11453
|
});
|
|
11249
11454
|
handlers.set("agent_profiles_list", async (args) => {
|
|
11250
11455
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11251
|
-
const core = await import("./dist-
|
|
11456
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11252
11457
|
const data = await listProfilesForDiscovery(core, config.baseUrl);
|
|
11253
11458
|
return withEnvelope({
|
|
11254
11459
|
command: "agents list",
|
|
@@ -11261,7 +11466,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11261
11466
|
throw new Error("profileId is required.");
|
|
11262
11467
|
}
|
|
11263
11468
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11264
|
-
const core = await import("./dist-
|
|
11469
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11265
11470
|
const data = await getProfileForDiscovery(core, config.baseUrl, profileId);
|
|
11266
11471
|
return withEnvelope({
|
|
11267
11472
|
command: "agents show",
|
|
@@ -11907,7 +12112,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11907
12112
|
});
|
|
11908
12113
|
handlers.set("auth_status", async (args) => {
|
|
11909
12114
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11910
|
-
const core = await import("./dist-
|
|
12115
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11911
12116
|
const data = await core.getAuthStatus(config.baseUrl, { validate: true });
|
|
11912
12117
|
return withEnvelope({
|
|
11913
12118
|
command: "auth status",
|
|
@@ -11916,7 +12121,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11916
12121
|
});
|
|
11917
12122
|
handlers.set("status", async (args) => {
|
|
11918
12123
|
const config = await resolveInvocationConfig(serverOptions, args);
|
|
11919
|
-
const core = await import("./dist-
|
|
12124
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11920
12125
|
const auth = await core.getAuthStatus(config.baseUrl, { validate: true });
|
|
11921
12126
|
return withEnvelope({
|
|
11922
12127
|
command: "status",
|
|
@@ -11947,7 +12152,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
11947
12152
|
}
|
|
11948
12153
|
];
|
|
11949
12154
|
try {
|
|
11950
|
-
const core = await import("./dist-
|
|
12155
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
11951
12156
|
core.assertSecureBaseUrl(config.baseUrl);
|
|
11952
12157
|
checks.push({
|
|
11953
12158
|
id: "base-url-secure",
|
|
@@ -12467,7 +12672,7 @@ var buildToolHandlers = (serverOptions) => {
|
|
|
12467
12672
|
} catch {
|
|
12468
12673
|
token = config.accessKey;
|
|
12469
12674
|
}
|
|
12470
|
-
const core = await import("./dist-
|
|
12675
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
12471
12676
|
const data = await core.getBillingConfig({
|
|
12472
12677
|
baseUrl: config.baseUrl,
|
|
12473
12678
|
authToken: token
|
|
@@ -13363,7 +13568,7 @@ var registerCapabilitiesCommand = (program2, deps) => {
|
|
|
13363
13568
|
warnIfAccessKeyFromCliOption(options, command);
|
|
13364
13569
|
let data = capabilities;
|
|
13365
13570
|
if (options.live) {
|
|
13366
|
-
const core = await import("./dist-
|
|
13571
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13367
13572
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
13368
13573
|
const accessKey = options.accessKeyStdin ? await deps.readStdinValue() : options.accessKey;
|
|
13369
13574
|
const token = await core.getAuthToken({ accessKey, baseUrl });
|
|
@@ -13501,7 +13706,7 @@ var writeCredentialOutput = async (input) => {
|
|
|
13501
13706
|
};
|
|
13502
13707
|
var resolveCoreAuth = async (options, command, deps) => {
|
|
13503
13708
|
const context = await resolveAuthContext(options, command, deps);
|
|
13504
|
-
const core = await import("./dist-
|
|
13709
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13505
13710
|
return { ...context, core };
|
|
13506
13711
|
};
|
|
13507
13712
|
var parseCapabilities = (value) => value?.split(",").map((item) => item.trim()).filter(Boolean);
|
|
@@ -13834,7 +14039,7 @@ var registerAgentsCommand = (program2, deps) => {
|
|
|
13834
14039
|
const agents = program2.command("agents").description("CloudEval Agent Profile utilities");
|
|
13835
14040
|
addAgentOutputOptions(agents.command("list").description("List Agent Profiles"), deps).action(async (options, command) => {
|
|
13836
14041
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
13837
|
-
const core = await import("./dist-
|
|
14042
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13838
14043
|
core.assertSecureBaseUrl(baseUrl);
|
|
13839
14044
|
const data = await listProfilesForDiscovery2(core, baseUrl);
|
|
13840
14045
|
await writeProfiles({
|
|
@@ -13850,7 +14055,7 @@ var registerAgentsCommand = (program2, deps) => {
|
|
|
13850
14055
|
deps
|
|
13851
14056
|
).action(async (profileId, options, command) => {
|
|
13852
14057
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
13853
|
-
const core = await import("./dist-
|
|
14058
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13854
14059
|
core.assertSecureBaseUrl(baseUrl);
|
|
13855
14060
|
const data = await getProfileForDiscovery2(core, baseUrl, profileId);
|
|
13856
14061
|
await writeProfiles({
|
|
@@ -13869,7 +14074,7 @@ var registerAgentsCommand = (program2, deps) => {
|
|
|
13869
14074
|
const cliProfile = getActiveConfigProfile(command);
|
|
13870
14075
|
const cliConfig = await loadCliConfig(cliProfile);
|
|
13871
14076
|
const auth = await resolveAuthContext(options, command, deps);
|
|
13872
|
-
const core = await import("./dist-
|
|
14077
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
13873
14078
|
const profileResponse = await core.getAgentProfile({
|
|
13874
14079
|
baseUrl: auth.baseUrl,
|
|
13875
14080
|
authToken: auth.token,
|
|
@@ -14431,7 +14636,7 @@ var registerDiagnosticsCommands = (program2, deps) => {
|
|
|
14431
14636
|
const baseUrl = await deps.resolveBaseUrl(options, command);
|
|
14432
14637
|
const profile = getActiveConfigProfile(command);
|
|
14433
14638
|
const config = await loadCliConfig(profile);
|
|
14434
|
-
const core = await import("./dist-
|
|
14639
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14435
14640
|
const auth = await core.getAuthStatus(baseUrl, { validate: true });
|
|
14436
14641
|
if (options.format === "text" || !options.format) {
|
|
14437
14642
|
process.stdout.write(
|
|
@@ -14481,7 +14686,7 @@ var registerDiagnosticsCommands = (program2, deps) => {
|
|
|
14481
14686
|
detail: getCliConfigPath(profile)
|
|
14482
14687
|
});
|
|
14483
14688
|
try {
|
|
14484
|
-
const core = await import("./dist-
|
|
14689
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14485
14690
|
core.assertSecureBaseUrl(baseUrl);
|
|
14486
14691
|
checks.push({
|
|
14487
14692
|
id: "base-url-secure",
|
|
@@ -14581,7 +14786,7 @@ var resolveToken2 = async (options, deps, baseUrl, command) => {
|
|
|
14581
14786
|
return options.accessKey;
|
|
14582
14787
|
}
|
|
14583
14788
|
try {
|
|
14584
|
-
const core = await import("./dist-
|
|
14789
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14585
14790
|
return await core.getAuthToken({
|
|
14586
14791
|
baseUrl
|
|
14587
14792
|
});
|
|
@@ -14665,7 +14870,7 @@ var registerModelsCommand = (program2, deps) => {
|
|
|
14665
14870
|
let source = "fallback";
|
|
14666
14871
|
let modelList = fallbackModels;
|
|
14667
14872
|
try {
|
|
14668
|
-
const core = await import("./dist-
|
|
14873
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
14669
14874
|
const response = await fetch(`${core.normalizeApiBase(baseUrl)}/models`, {
|
|
14670
14875
|
headers: {
|
|
14671
14876
|
Accept: "application/json",
|
|
@@ -15786,9 +15991,13 @@ var enableCliDebugLogging = () => {
|
|
|
15786
15991
|
process.env.CLOUDEVAL_CLI_DEBUG = "1";
|
|
15787
15992
|
};
|
|
15788
15993
|
var redactSensitive = (value) => redactSensitiveSecrets(value);
|
|
15789
|
-
var isHeadlessEnvironment = () => Boolean(
|
|
15994
|
+
var isHeadlessEnvironment = () => Boolean(
|
|
15995
|
+
process.env.SSH_TTY || process.env.CI || process.env.CLOUDEVAL_HEADLESS_LOGIN
|
|
15996
|
+
);
|
|
15790
15997
|
var assertNoLegacyApiKeyUsage = () => {
|
|
15791
|
-
const legacyArg = process.argv.slice(2).some(
|
|
15998
|
+
const legacyArg = process.argv.slice(2).some(
|
|
15999
|
+
(arg) => arg === "--api-key" || arg === "--api-key-stdin" || arg.startsWith("--api-key=")
|
|
16000
|
+
);
|
|
15792
16001
|
if (legacyArg || process.env.CLOUDEVAL_API_KEY) {
|
|
15793
16002
|
process.stderr.write(`${LEGACY_API_KEY_MESSAGE}
|
|
15794
16003
|
`);
|
|
@@ -15800,13 +16009,31 @@ var completionScriptPath = (shell) => {
|
|
|
15800
16009
|
const home = os6.homedir();
|
|
15801
16010
|
switch (shell) {
|
|
15802
16011
|
case "bash":
|
|
15803
|
-
return path10.join(
|
|
16012
|
+
return path10.join(
|
|
16013
|
+
home,
|
|
16014
|
+
".local",
|
|
16015
|
+
"share",
|
|
16016
|
+
"bash-completion",
|
|
16017
|
+
"completions",
|
|
16018
|
+
"cloudeval"
|
|
16019
|
+
);
|
|
15804
16020
|
case "zsh":
|
|
15805
16021
|
return path10.join(home, ".zsh", "completions", "_cloudeval");
|
|
15806
16022
|
case "fish":
|
|
15807
|
-
return path10.join(
|
|
16023
|
+
return path10.join(
|
|
16024
|
+
home,
|
|
16025
|
+
".config",
|
|
16026
|
+
"fish",
|
|
16027
|
+
"completions",
|
|
16028
|
+
"cloudeval.fish"
|
|
16029
|
+
);
|
|
15808
16030
|
case "powershell":
|
|
15809
|
-
return path10.join(
|
|
16031
|
+
return path10.join(
|
|
16032
|
+
home,
|
|
16033
|
+
".config",
|
|
16034
|
+
"powershell",
|
|
16035
|
+
"cloudeval-completion.ps1"
|
|
16036
|
+
);
|
|
15810
16037
|
}
|
|
15811
16038
|
};
|
|
15812
16039
|
var ZSH_FPATH_MARKER = "CloudEval CLI completions";
|
|
@@ -15830,7 +16057,11 @@ fpath=("$HOME/.zsh/completions" $fpath)
|
|
|
15830
16057
|
var installCompletionScript = async (shell, binaryName) => {
|
|
15831
16058
|
const scriptPath = completionScriptPath(shell);
|
|
15832
16059
|
await fs13.mkdir(path10.dirname(scriptPath), { recursive: true });
|
|
15833
|
-
await fs13.writeFile(
|
|
16060
|
+
await fs13.writeFile(
|
|
16061
|
+
scriptPath,
|
|
16062
|
+
buildCompletionScript(shell, binaryName),
|
|
16063
|
+
"utf8"
|
|
16064
|
+
);
|
|
15834
16065
|
if (shell === "zsh") {
|
|
15835
16066
|
await ensureZshCompletionFpath();
|
|
15836
16067
|
}
|
|
@@ -15844,7 +16075,7 @@ var uninstallCompletionScript = async (shell) => {
|
|
|
15844
16075
|
var runInteractiveLoginOnboarding = async (baseUrl, token) => {
|
|
15845
16076
|
const [{ render }, { Onboarding }] = await Promise.all([
|
|
15846
16077
|
import("ink"),
|
|
15847
|
-
import("./Onboarding-
|
|
16078
|
+
import("./Onboarding-ZHKPXN5Z.js")
|
|
15848
16079
|
]);
|
|
15849
16080
|
await new Promise((resolve) => {
|
|
15850
16081
|
let app;
|
|
@@ -15865,7 +16096,9 @@ var runInteractiveLoginOnboarding = async (baseUrl, token) => {
|
|
|
15865
16096
|
};
|
|
15866
16097
|
var readStdinValue = async () => {
|
|
15867
16098
|
if (process.stdin.isTTY) {
|
|
15868
|
-
throw new Error(
|
|
16099
|
+
throw new Error(
|
|
16100
|
+
"No stdin available. Pipe a value into --access-key-stdin."
|
|
16101
|
+
);
|
|
15869
16102
|
}
|
|
15870
16103
|
const chunks = [];
|
|
15871
16104
|
for await (const chunk of process.stdin) {
|
|
@@ -15918,7 +16151,9 @@ var progressEventFromChunk = (chunk, options) => {
|
|
|
15918
16151
|
return {
|
|
15919
16152
|
type: "action",
|
|
15920
16153
|
step: "hitl",
|
|
15921
|
-
message: truncateProgressText(
|
|
16154
|
+
message: truncateProgressText(
|
|
16155
|
+
firstQuestion?.text || "Human input required"
|
|
16156
|
+
)
|
|
15922
16157
|
};
|
|
15923
16158
|
}
|
|
15924
16159
|
if (chunk.type === "hitl_resume") {
|
|
@@ -15926,7 +16161,9 @@ var progressEventFromChunk = (chunk, options) => {
|
|
|
15926
16161
|
type: "action",
|
|
15927
16162
|
step: "hitl_resume",
|
|
15928
16163
|
status: chunk.status,
|
|
15929
|
-
message: truncateProgressText(
|
|
16164
|
+
message: truncateProgressText(
|
|
16165
|
+
chunk.message || "Resuming with supplied input"
|
|
16166
|
+
)
|
|
15930
16167
|
};
|
|
15931
16168
|
}
|
|
15932
16169
|
return null;
|
|
@@ -15953,7 +16190,11 @@ var normalizeModelEntry = (raw) => {
|
|
|
15953
16190
|
if (typeof id !== "string" || !id.trim()) {
|
|
15954
16191
|
return null;
|
|
15955
16192
|
}
|
|
15956
|
-
return {
|
|
16193
|
+
return {
|
|
16194
|
+
...value,
|
|
16195
|
+
id,
|
|
16196
|
+
name: typeof value.name === "string" ? value.name : id
|
|
16197
|
+
};
|
|
15957
16198
|
};
|
|
15958
16199
|
var normalizeModelsPayload2 = (payload) => {
|
|
15959
16200
|
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 +16215,15 @@ var assertModelAvailable2 = async (input) => {
|
|
|
15974
16215
|
return;
|
|
15975
16216
|
}
|
|
15976
16217
|
try {
|
|
15977
|
-
const response = await fetch(
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
16218
|
+
const response = await fetch(
|
|
16219
|
+
`${input.normalizeApiBase(input.baseUrl)}/models`,
|
|
16220
|
+
{
|
|
16221
|
+
headers: {
|
|
16222
|
+
Accept: "application/json",
|
|
16223
|
+
...input.authToken ? { Authorization: `Bearer ${input.authToken}` } : {}
|
|
16224
|
+
}
|
|
15981
16225
|
}
|
|
15982
|
-
|
|
16226
|
+
);
|
|
15983
16227
|
if (!response.ok) {
|
|
15984
16228
|
return;
|
|
15985
16229
|
}
|
|
@@ -16178,17 +16422,20 @@ var resolveBaseUrl = async (options, command) => {
|
|
|
16178
16422
|
});
|
|
16179
16423
|
}
|
|
16180
16424
|
try {
|
|
16181
|
-
const { getAuthStatus } = await import("./dist-
|
|
16425
|
+
const { getAuthStatus } = await import("./dist-6LEMVXIY.js");
|
|
16182
16426
|
const status = await getAuthStatus();
|
|
16183
16427
|
const storedBaseUrl = status.baseUrl;
|
|
16184
16428
|
if (storedBaseUrl && shouldUseStoredBaseUrl(storedBaseUrl)) {
|
|
16185
16429
|
return storedBaseUrl;
|
|
16186
16430
|
}
|
|
16187
16431
|
if (storedBaseUrl) {
|
|
16188
|
-
verboseLog(
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16432
|
+
verboseLog(
|
|
16433
|
+
"Ignoring stored local auth base URL. Use --base-url or CLOUDEVAL_BASE_URL for local backend testing.",
|
|
16434
|
+
{
|
|
16435
|
+
storedBaseUrl,
|
|
16436
|
+
selectedBaseUrl: configuredBaseUrl
|
|
16437
|
+
}
|
|
16438
|
+
);
|
|
16192
16439
|
}
|
|
16193
16440
|
} catch {
|
|
16194
16441
|
}
|
|
@@ -16201,7 +16448,9 @@ var resolveCliConfig = async (command) => {
|
|
|
16201
16448
|
return {};
|
|
16202
16449
|
}
|
|
16203
16450
|
};
|
|
16204
|
-
program.name("cloudeval").description(
|
|
16451
|
+
program.name("cloudeval").description(
|
|
16452
|
+
"CloudEval CLI. Run without arguments to open the Terminal UI; use subcommands for pipeable CLI workflows."
|
|
16453
|
+
).version(CLI_VERSION).addHelpText(
|
|
16205
16454
|
"after",
|
|
16206
16455
|
`
|
|
16207
16456
|
|
|
@@ -16214,11 +16463,20 @@ Examples:
|
|
|
16214
16463
|
cloudeval projects create --template-url https://example.com/template.json --format json
|
|
16215
16464
|
cloudeval projects export-diagram <id> --layout architecture --format png --labels all --output architecture.png
|
|
16216
16465
|
cloudeval reports download --project <id> --type all --output ./reports
|
|
16466
|
+
cloudeval reports download --project <id> --type all --format pdf --report-verbosity evidence --output ./report.pdf
|
|
16217
16467
|
cloudeval open project <id> --view both --layout dependency --print-url --no-open
|
|
16218
16468
|
cloudeval capabilities --format json
|
|
16219
16469
|
cloudeval update --check
|
|
16220
16470
|
`
|
|
16221
|
-
).option(
|
|
16471
|
+
).option(
|
|
16472
|
+
"--profile <name>",
|
|
16473
|
+
"Configuration profile",
|
|
16474
|
+
process.env.CLOUDEVAL_PROFILE
|
|
16475
|
+
).option("-v, --verbose", "Enable verbose logging", false).option(
|
|
16476
|
+
"--show-sensitive-ids",
|
|
16477
|
+
"Show full account/session identifiers in command output",
|
|
16478
|
+
false
|
|
16479
|
+
).hook("preAction", async (thisCommand, actionCommand) => {
|
|
16222
16480
|
const opts = typeof actionCommand.optsWithGlobals === "function" ? actionCommand.optsWithGlobals() : thisCommand.opts();
|
|
16223
16481
|
await initializeCommandTelemetry(actionCommand, opts);
|
|
16224
16482
|
setShowSensitiveIds(Boolean(opts.showSensitiveIds || opts.verbose));
|
|
@@ -16235,16 +16493,19 @@ Examples:
|
|
|
16235
16493
|
await finishCommandTelemetry(0);
|
|
16236
16494
|
});
|
|
16237
16495
|
program.addHelpCommand(false);
|
|
16238
|
-
program.command("login").description("Authenticate with Cloudeval").option(
|
|
16239
|
-
"--
|
|
16240
|
-
"
|
|
16241
|
-
|
|
16242
|
-
).option("
|
|
16496
|
+
program.command("login").description("Authenticate with Cloudeval").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option(
|
|
16497
|
+
"--headless",
|
|
16498
|
+
"Use device-code login flow (for SSH/headless terminals)",
|
|
16499
|
+
false
|
|
16500
|
+
).option("-v, --verbose", "Enable verbose logging", false).action(async (options) => {
|
|
16243
16501
|
if (options.verbose) {
|
|
16244
16502
|
setVerbose(true);
|
|
16245
16503
|
verboseLog("Login command started");
|
|
16246
16504
|
verboseLog("Base URL:", options.baseUrl);
|
|
16247
|
-
verboseLog(
|
|
16505
|
+
verboseLog(
|
|
16506
|
+
"Environment CLOUDEVAL_BASE_URL:",
|
|
16507
|
+
process.env.CLOUDEVAL_BASE_URL
|
|
16508
|
+
);
|
|
16248
16509
|
}
|
|
16249
16510
|
try {
|
|
16250
16511
|
const {
|
|
@@ -16252,7 +16513,7 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16252
16513
|
checkUserStatus,
|
|
16253
16514
|
ensurePlaygroundProject,
|
|
16254
16515
|
login
|
|
16255
|
-
} = await import("./dist-
|
|
16516
|
+
} = await import("./dist-6LEMVXIY.js");
|
|
16256
16517
|
assertSecureBaseUrl(options.baseUrl);
|
|
16257
16518
|
const headlessEnvironment = isHeadlessEnvironment();
|
|
16258
16519
|
const headlessLogin = options.headless || headlessEnvironment;
|
|
@@ -16271,7 +16532,9 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16271
16532
|
stdoutIsTTY: process.stdout.isTTY
|
|
16272
16533
|
});
|
|
16273
16534
|
if (onboardingMode === "interactive_steps") {
|
|
16274
|
-
console.log(
|
|
16535
|
+
console.log(
|
|
16536
|
+
"Complete CLI onboarding to set up your Playground project."
|
|
16537
|
+
);
|
|
16275
16538
|
await runInteractiveLoginOnboarding(options.baseUrl, token);
|
|
16276
16539
|
console.log("\u2705 Onboarding complete. Playground project ready.");
|
|
16277
16540
|
} else {
|
|
@@ -16290,19 +16553,17 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16290
16553
|
console.log("\u2705 Playground project ready.");
|
|
16291
16554
|
}
|
|
16292
16555
|
} else {
|
|
16293
|
-
await ensurePlaygroundProject(
|
|
16294
|
-
|
|
16295
|
-
|
|
16296
|
-
|
|
16297
|
-
|
|
16298
|
-
|
|
16299
|
-
full_name: userStatus.user.full_name,
|
|
16300
|
-
name: userStatus.user.name
|
|
16301
|
-
}
|
|
16302
|
-
);
|
|
16556
|
+
await ensurePlaygroundProject(options.baseUrl, token, {
|
|
16557
|
+
id: userStatus.user.id,
|
|
16558
|
+
email: userStatus.user.email,
|
|
16559
|
+
full_name: userStatus.user.full_name,
|
|
16560
|
+
name: userStatus.user.name
|
|
16561
|
+
});
|
|
16303
16562
|
}
|
|
16304
16563
|
} else {
|
|
16305
|
-
verboseLog(
|
|
16564
|
+
verboseLog(
|
|
16565
|
+
"Skipping Playground setup because authenticated user details were unavailable"
|
|
16566
|
+
);
|
|
16306
16567
|
}
|
|
16307
16568
|
await getActiveCliTelemetry()?.track("cli.auth", {
|
|
16308
16569
|
command: "login",
|
|
@@ -16321,13 +16582,9 @@ program.command("login").description("Authenticate with Cloudeval").option(
|
|
|
16321
16582
|
await exitCli(1, error);
|
|
16322
16583
|
}
|
|
16323
16584
|
});
|
|
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) => {
|
|
16585
|
+
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
16586
|
try {
|
|
16330
|
-
const { assertSecureBaseUrl, logout } = await import("./dist-
|
|
16587
|
+
const { assertSecureBaseUrl, logout } = await import("./dist-6LEMVXIY.js");
|
|
16331
16588
|
assertSecureBaseUrl(options.baseUrl);
|
|
16332
16589
|
const result = await logout({
|
|
16333
16590
|
baseUrl: options.baseUrl,
|
|
@@ -16355,13 +16612,21 @@ program.command("logout").description("Log out and clear stored authentication s
|
|
|
16355
16612
|
}
|
|
16356
16613
|
});
|
|
16357
16614
|
var authCommand = program.command("auth").description("Authentication utilities");
|
|
16358
|
-
authCommand.command("status").description("Show current authentication status").option(
|
|
16359
|
-
"--
|
|
16360
|
-
"
|
|
16361
|
-
|
|
16362
|
-
).option(
|
|
16615
|
+
authCommand.command("status").description("Show current authentication status").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option(
|
|
16616
|
+
"--format <format>",
|
|
16617
|
+
"Output format: text, json, ndjson, markdown",
|
|
16618
|
+
"text"
|
|
16619
|
+
).option(
|
|
16620
|
+
"--show-sensitive-ids",
|
|
16621
|
+
"Show full account/session identifiers in command output",
|
|
16622
|
+
false
|
|
16623
|
+
).option(
|
|
16624
|
+
"-v, --verbose",
|
|
16625
|
+
"Enable verbose logging and show full non-token identifiers",
|
|
16626
|
+
false
|
|
16627
|
+
).action(async (options, command) => {
|
|
16363
16628
|
try {
|
|
16364
|
-
const { assertSecureBaseUrl, getAuthStatus } = await import("./dist-
|
|
16629
|
+
const { assertSecureBaseUrl, getAuthStatus } = await import("./dist-6LEMVXIY.js");
|
|
16365
16630
|
const effectiveBaseUrl = await resolveBaseUrl(options, command);
|
|
16366
16631
|
assertSecureBaseUrl(effectiveBaseUrl);
|
|
16367
16632
|
const status = await getAuthStatus(effectiveBaseUrl, { validate: true });
|
|
@@ -16410,7 +16675,9 @@ authCommand.command("status").description("Show current authentication status").
|
|
|
16410
16675
|
success: false,
|
|
16411
16676
|
errorCategory: classifyTelemetryError(error)
|
|
16412
16677
|
});
|
|
16413
|
-
console.error(
|
|
16678
|
+
console.error(
|
|
16679
|
+
`\u274C Failed to fetch auth status: ${error?.message || "Unknown error"}`
|
|
16680
|
+
);
|
|
16414
16681
|
await exitCli(1, error);
|
|
16415
16682
|
}
|
|
16416
16683
|
});
|
|
@@ -16522,19 +16789,21 @@ registerMcpCommand(program, {
|
|
|
16522
16789
|
registerUpdateCommand(program, { getTelemetry: getActiveCliTelemetry });
|
|
16523
16790
|
registerUninstallCommand(program);
|
|
16524
16791
|
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
|
-
});
|
|
16792
|
+
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(
|
|
16793
|
+
async (options) => {
|
|
16794
|
+
await getActiveCliTelemetry()?.track("cli.install", {
|
|
16795
|
+
installerType: enumLikeValue(options.installerType),
|
|
16796
|
+
requestedVersion: versionLikeValue(options.requestedVersion),
|
|
16797
|
+
resolvedVersion: versionLikeValue(options.resolvedVersion),
|
|
16798
|
+
platform: enumLikeValue(options.platform),
|
|
16799
|
+
aliases: enumLikeValue(options.aliases),
|
|
16800
|
+
completions: enumLikeValue(options.completions),
|
|
16801
|
+
mcpSetup: enumLikeValue(options.mcpSetup),
|
|
16802
|
+
installerResult: enumLikeValue(options.result) ?? "success",
|
|
16803
|
+
success: options.result !== "failure"
|
|
16804
|
+
});
|
|
16805
|
+
}
|
|
16806
|
+
);
|
|
16538
16807
|
program.command("__complete").description("Internal completion endpoint").argument("[words...]", "Completion words").action((words = []) => {
|
|
16539
16808
|
const candidates = completeCliWords(words);
|
|
16540
16809
|
for (const candidate of candidates) {
|
|
@@ -16544,7 +16813,10 @@ program.command("__complete").description("Internal completion endpoint").argume
|
|
|
16544
16813
|
);
|
|
16545
16814
|
}
|
|
16546
16815
|
});
|
|
16547
|
-
var completionCommand = program.command("completion").description("Print or install shell completion scripts").argument(
|
|
16816
|
+
var completionCommand = program.command("completion").description("Print or install shell completion scripts").argument(
|
|
16817
|
+
"[shell]",
|
|
16818
|
+
"Shell to generate completions for: bash, zsh, fish, powershell"
|
|
16819
|
+
).option("--bin <name>", "Primary binary name", "cloudeval").action(async (shellName, options) => {
|
|
16548
16820
|
const detectedShell = process.env.SHELL?.split("/").pop();
|
|
16549
16821
|
const shell = normalizeCompletionShell(shellName || detectedShell);
|
|
16550
16822
|
if (!shell) {
|
|
@@ -16581,19 +16853,23 @@ completionCommand.command("uninstall").description("Remove installed shell compl
|
|
|
16581
16853
|
process.stdout.write(`Removed ${shell} completion at ${scriptPath}
|
|
16582
16854
|
`);
|
|
16583
16855
|
});
|
|
16584
|
-
program.command("tui").description("Open the CloudEval Terminal UI").option(
|
|
16585
|
-
"--
|
|
16586
|
-
"
|
|
16587
|
-
|
|
16588
|
-
).option("--
|
|
16856
|
+
program.command("tui").description("Open the CloudEval Terminal UI").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option(
|
|
16857
|
+
"--tab <tab>",
|
|
16858
|
+
"Initial tab: chat, overview, reports, projects, connections, billing, options, help",
|
|
16859
|
+
"chat"
|
|
16860
|
+
).option("--project <id>", "Initial project id").option("--frontend-url <url>", "Frontend base URL").option("--mode <mode>", "Initial chat mode: ask, agent").option(
|
|
16589
16861
|
"--access-key <key>",
|
|
16590
16862
|
"Access key for automation",
|
|
16591
16863
|
process.env.CLOUDEVAL_ACCESS_KEY
|
|
16592
|
-
).option(
|
|
16593
|
-
|
|
16864
|
+
).option(
|
|
16865
|
+
"--access-key-stdin",
|
|
16866
|
+
"Read access key from stdin (recommended for automation)",
|
|
16867
|
+
false
|
|
16868
|
+
).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) => {
|
|
16869
|
+
const { assertSecureBaseUrl } = await import("./dist-6LEMVXIY.js");
|
|
16594
16870
|
const [{ render }, { App }] = await Promise.all([
|
|
16595
16871
|
import("ink"),
|
|
16596
|
-
import("./App-
|
|
16872
|
+
import("./App-IRVY4LSK.js")
|
|
16597
16873
|
]);
|
|
16598
16874
|
const baseUrl = await resolveBaseUrl(options, command);
|
|
16599
16875
|
assertSecureBaseUrl(baseUrl);
|
|
@@ -16639,19 +16915,22 @@ program.command("tui").description("Open the CloudEval Terminal UI").option(
|
|
|
16639
16915
|
);
|
|
16640
16916
|
await app.waitUntilExit();
|
|
16641
16917
|
});
|
|
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(
|
|
16918
|
+
program.command("chat").description("Start an interactive chat session").option("--base-url <url>", "Backend base URL", DEFAULT_BASE_URL).option(
|
|
16647
16919
|
"--access-key <key>",
|
|
16648
16920
|
"Access key for automation",
|
|
16649
16921
|
process.env.CLOUDEVAL_ACCESS_KEY
|
|
16650
|
-
).option(
|
|
16651
|
-
|
|
16922
|
+
).option(
|
|
16923
|
+
"--access-key-stdin",
|
|
16924
|
+
"Read access key from stdin (recommended for automation)",
|
|
16925
|
+
false
|
|
16926
|
+
).option("--conversation <id>", "Conversation/thread id to resume").option("--continue", "Resume the most recent local chat session", false).option(
|
|
16927
|
+
"--resume <id-or-title>",
|
|
16928
|
+
"Resume a local chat session by thread id or title"
|
|
16929
|
+
).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) => {
|
|
16930
|
+
const { assertSecureBaseUrl } = await import("./dist-6LEMVXIY.js");
|
|
16652
16931
|
const [{ render }, { App }] = await Promise.all([
|
|
16653
16932
|
import("ink"),
|
|
16654
|
-
import("./App-
|
|
16933
|
+
import("./App-IRVY4LSK.js")
|
|
16655
16934
|
]);
|
|
16656
16935
|
const baseUrl = await resolveBaseUrl(options, command);
|
|
16657
16936
|
assertSecureBaseUrl(baseUrl);
|
|
@@ -16714,19 +16993,27 @@ program.command("chat").description("Start an interactive chat session").option(
|
|
|
16714
16993
|
);
|
|
16715
16994
|
await app.waitUntilExit();
|
|
16716
16995
|
});
|
|
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(
|
|
16996
|
+
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
16997
|
"--access-key <key>",
|
|
16723
16998
|
"Access key for automation",
|
|
16724
16999
|
process.env.CLOUDEVAL_ACCESS_KEY
|
|
16725
|
-
).option(
|
|
17000
|
+
).option(
|
|
17001
|
+
"--access-key-stdin",
|
|
17002
|
+
"Read access key from stdin (recommended for automation)",
|
|
17003
|
+
false
|
|
17004
|
+
).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(
|
|
17005
|
+
"--format <format>",
|
|
17006
|
+
"Output format: text, json, ndjson, markdown",
|
|
17007
|
+
"text"
|
|
17008
|
+
).option("--json", "Output as JSON").option(
|
|
17009
|
+
"--progress <mode>",
|
|
17010
|
+
"Progress events: auto, stderr, ndjson, none",
|
|
17011
|
+
"auto"
|
|
17012
|
+
).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
17013
|
const question = Array.isArray(questionParts) ? questionParts.join(" ") : String(questionParts);
|
|
16727
17014
|
const commandName = command.parent?.args?.[0] === "agent" ? "agent" : "ask";
|
|
16728
17015
|
const selectedMode = commandName === "agent" ? "agent" : "ask";
|
|
16729
|
-
const { assertSecureBaseUrl } = await import("./dist-
|
|
17016
|
+
const { assertSecureBaseUrl } = await import("./dist-6LEMVXIY.js");
|
|
16730
17017
|
const baseUrl = await resolveBaseUrl(options, command);
|
|
16731
17018
|
assertSecureBaseUrl(baseUrl);
|
|
16732
17019
|
const selectedProfile = getActiveConfigProfile(command);
|
|
@@ -16767,7 +17054,7 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16767
17054
|
const fs14 = await import("fs");
|
|
16768
17055
|
const fsPromises = await import("fs/promises");
|
|
16769
17056
|
const { randomUUID: randomUUID5 } = await import("crypto");
|
|
16770
|
-
const core = await import("./dist-
|
|
17057
|
+
const core = await import("./dist-6LEMVXIY.js");
|
|
16771
17058
|
const {
|
|
16772
17059
|
streamChat,
|
|
16773
17060
|
reduceChunk,
|
|
@@ -16820,10 +17107,12 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16820
17107
|
verboseLog("No authentication available, initiating login flow");
|
|
16821
17108
|
if (!options.quiet) {
|
|
16822
17109
|
progressWriter.clear();
|
|
16823
|
-
console.error(
|
|
17110
|
+
console.error(
|
|
17111
|
+
"Authentication required. Starting login process...\n"
|
|
17112
|
+
);
|
|
16824
17113
|
}
|
|
16825
17114
|
try {
|
|
16826
|
-
const { login } = await import("./dist-
|
|
17115
|
+
const { login } = await import("./dist-6LEMVXIY.js");
|
|
16827
17116
|
verboseLog("Calling interactive login", { baseUrl });
|
|
16828
17117
|
token = await login(baseUrl, {
|
|
16829
17118
|
headless: isHeadlessEnvironment()
|
|
@@ -16831,7 +17120,9 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16831
17120
|
verboseLog("Login successful, proceeding with question");
|
|
16832
17121
|
if (!options.quiet) {
|
|
16833
17122
|
progressWriter.clear();
|
|
16834
|
-
console.error(
|
|
17123
|
+
console.error(
|
|
17124
|
+
"\nAuthentication successful. Proceeding with your question...\n"
|
|
17125
|
+
);
|
|
16835
17126
|
}
|
|
16836
17127
|
} catch (loginError) {
|
|
16837
17128
|
verboseLog("Login failed:", {
|
|
@@ -16887,7 +17178,7 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16887
17178
|
message: error.message
|
|
16888
17179
|
});
|
|
16889
17180
|
}
|
|
16890
|
-
const { resolveAskProject } = await import("./resolveAskProject-
|
|
17181
|
+
const { resolveAskProject } = await import("./resolveAskProject-XM4W4DON.js");
|
|
16891
17182
|
let project;
|
|
16892
17183
|
try {
|
|
16893
17184
|
project = await resolveAskProject({
|
|
@@ -16925,15 +17216,21 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16925
17216
|
const emittedProgressKeys = /* @__PURE__ */ new Set();
|
|
16926
17217
|
if (options.debug) {
|
|
16927
17218
|
console.error(`[${commandName}] Question: ${question}`);
|
|
16928
|
-
console.error(
|
|
17219
|
+
console.error(
|
|
17220
|
+
`[${commandName}] Project: ${project.id} (${project.name})`
|
|
17221
|
+
);
|
|
16929
17222
|
console.error(`[${commandName}] Thread ID: ${threadId}`);
|
|
16930
17223
|
}
|
|
16931
17224
|
if (streamTextOutput && options.output) {
|
|
16932
|
-
fileOutputStream = fs14.createWriteStream(options.output, {
|
|
17225
|
+
fileOutputStream = fs14.createWriteStream(options.output, {
|
|
17226
|
+
encoding: "utf-8"
|
|
17227
|
+
});
|
|
16933
17228
|
outputStream = fileOutputStream;
|
|
16934
17229
|
}
|
|
16935
17230
|
if (ndjsonOutput && options.output) {
|
|
16936
|
-
ndjsonOutputStream = fs14.createWriteStream(options.output, {
|
|
17231
|
+
ndjsonOutputStream = fs14.createWriteStream(options.output, {
|
|
17232
|
+
encoding: "utf-8"
|
|
17233
|
+
});
|
|
16937
17234
|
}
|
|
16938
17235
|
const writeAskDataEvent = (event) => {
|
|
16939
17236
|
const line = `${JSON.stringify(event)}
|
|
@@ -16961,12 +17258,9 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16961
17258
|
if (!event) {
|
|
16962
17259
|
return;
|
|
16963
17260
|
}
|
|
16964
|
-
const key = [
|
|
16965
|
-
|
|
16966
|
-
|
|
16967
|
-
event.status,
|
|
16968
|
-
event.message
|
|
16969
|
-
].join(":");
|
|
17261
|
+
const key = [event.type, event.step, event.status, event.message].join(
|
|
17262
|
+
":"
|
|
17263
|
+
);
|
|
16970
17264
|
if (emittedProgressKeys.has(key)) {
|
|
16971
17265
|
return;
|
|
16972
17266
|
}
|
|
@@ -16991,7 +17285,7 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
16991
17285
|
});
|
|
16992
17286
|
const logHeaders = {
|
|
16993
17287
|
"Content-Type": "application/json",
|
|
16994
|
-
|
|
17288
|
+
Accept: "text/event-stream"
|
|
16995
17289
|
};
|
|
16996
17290
|
if (token) {
|
|
16997
17291
|
logHeaders["Authorization"] = `Bearer [REDACTED]`;
|
|
@@ -17029,7 +17323,10 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
17029
17323
|
authToken: token,
|
|
17030
17324
|
message: hitlResume ? "" : question,
|
|
17031
17325
|
threadId,
|
|
17032
|
-
user: {
|
|
17326
|
+
user: {
|
|
17327
|
+
id: project.user_id ?? authenticatedUserId ?? "cli-user",
|
|
17328
|
+
name: userName
|
|
17329
|
+
},
|
|
17033
17330
|
project,
|
|
17034
17331
|
settings: streamSettings,
|
|
17035
17332
|
debug: options.debug,
|
|
@@ -17051,7 +17348,9 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
17051
17348
|
});
|
|
17052
17349
|
}
|
|
17053
17350
|
chatState = reduceChunk(chatState, chunk);
|
|
17054
|
-
writeChunkProgressEvent(
|
|
17351
|
+
writeChunkProgressEvent(
|
|
17352
|
+
progressEventFromChunk(chunk, { verbose: options.verbose })
|
|
17353
|
+
);
|
|
17055
17354
|
if (chunk.type === "hitl_request") {
|
|
17056
17355
|
pendingHitlRequest = chunk;
|
|
17057
17356
|
if (ndjsonOutput) {
|
|
@@ -17100,7 +17399,11 @@ program.command("ask").alias("agent").description("Ask a single question or run
|
|
|
17100
17399
|
if (jsonOutput) {
|
|
17101
17400
|
responseText = `Error: ${errorMsg}`;
|
|
17102
17401
|
} else if (ndjsonOutput) {
|
|
17103
|
-
writeAskDataEvent({
|
|
17402
|
+
writeAskDataEvent({
|
|
17403
|
+
type: "error",
|
|
17404
|
+
error: { message: errorMsg },
|
|
17405
|
+
threadId
|
|
17406
|
+
});
|
|
17104
17407
|
} else {
|
|
17105
17408
|
outputStream.write(`
|
|
17106
17409
|
Error: ${errorMsg}
|
|
@@ -17113,7 +17416,9 @@ Error: ${errorMsg}
|
|
|
17113
17416
|
} catch (error) {
|
|
17114
17417
|
if (!providedAccessKey && !retriedAfterAuthRefresh && isExpiredDeviceTokenStreamError(error)) {
|
|
17115
17418
|
retriedAfterAuthRefresh = true;
|
|
17116
|
-
verboseLog(
|
|
17419
|
+
verboseLog(
|
|
17420
|
+
"Stored device token expired during stream; refreshing and retrying once"
|
|
17421
|
+
);
|
|
17117
17422
|
progressWriter.write({
|
|
17118
17423
|
type: "auth",
|
|
17119
17424
|
step: "auth",
|
|
@@ -17143,7 +17448,11 @@ Error: ${errorMsg}
|
|
|
17143
17448
|
questions
|
|
17144
17449
|
};
|
|
17145
17450
|
const message = "Human input required by CloudEval.";
|
|
17146
|
-
const summary = summarizeHitlRequest({
|
|
17451
|
+
const summary = summarizeHitlRequest({
|
|
17452
|
+
questions,
|
|
17453
|
+
checkpointId,
|
|
17454
|
+
frontendUrl
|
|
17455
|
+
});
|
|
17147
17456
|
if (jsonOutput) {
|
|
17148
17457
|
const output = {
|
|
17149
17458
|
ok: false,
|
|
@@ -17172,7 +17481,11 @@ Error: ${errorMsg}
|
|
|
17172
17481
|
ok: false,
|
|
17173
17482
|
command: commandName,
|
|
17174
17483
|
error: { code: "HITL_REQUIRED", message },
|
|
17175
|
-
data: {
|
|
17484
|
+
data: {
|
|
17485
|
+
threadId: chatState.threadId,
|
|
17486
|
+
project: { id: project.id, name: project.name },
|
|
17487
|
+
hitl
|
|
17488
|
+
},
|
|
17176
17489
|
frontendUrl
|
|
17177
17490
|
});
|
|
17178
17491
|
await closeOutputStream();
|
|
@@ -17204,7 +17517,11 @@ Error: ${errorMsg}
|
|
|
17204
17517
|
if (jsonOutput) {
|
|
17205
17518
|
responseText = `Error: ${errorMsg}`;
|
|
17206
17519
|
} else if (ndjsonOutput) {
|
|
17207
|
-
writeAskDataEvent({
|
|
17520
|
+
writeAskDataEvent({
|
|
17521
|
+
type: "error",
|
|
17522
|
+
error: { message: errorMsg },
|
|
17523
|
+
threadId
|
|
17524
|
+
});
|
|
17208
17525
|
} else {
|
|
17209
17526
|
outputStream.write(`
|
|
17210
17527
|
Error: ${errorMsg}
|
|
@@ -17405,7 +17722,7 @@ Error: ${errorMsg}
|
|
|
17405
17722
|
program.command("banner").description("Preview the startup banner and terminal capabilities").action(async () => {
|
|
17406
17723
|
const { render } = await import("ink");
|
|
17407
17724
|
const BannerPreview = React.lazy(async () => ({
|
|
17408
|
-
default: (await import("./Banner-
|
|
17725
|
+
default: (await import("./Banner-4PWF5O3B.js")).Banner
|
|
17409
17726
|
}));
|
|
17410
17727
|
render(
|
|
17411
17728
|
/* @__PURE__ */ jsx(React.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(BannerPreview, { disable: false }) })
|