@ganakailabs/cloudeval-cli 0.24.4 → 0.25.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.
@@ -0,0 +1,27 @@
1
+ // src/fetchLastAssistantContent.ts
2
+ var fetchLastAssistantContent = async ({
3
+ baseUrl,
4
+ authToken,
5
+ threadId,
6
+ normalizeApiBase
7
+ }) => {
8
+ const response = await fetch(
9
+ `${normalizeApiBase(baseUrl)}/chat/threads/${encodeURIComponent(threadId)}`,
10
+ {
11
+ headers: {
12
+ Accept: "application/json",
13
+ Authorization: `Bearer ${authToken}`
14
+ }
15
+ }
16
+ );
17
+ if (!response.ok) {
18
+ return void 0;
19
+ }
20
+ const payload = await response.json();
21
+ const assistant = [...payload.messages ?? []].reverse().find((message) => message.role === "assistant");
22
+ const content = assistant?.content?.trim();
23
+ return content || void 0;
24
+ };
25
+ export {
26
+ fetchLastAssistantContent
27
+ };
@@ -0,0 +1,49 @@
1
+ // src/resolveAskProject.ts
2
+ var resolveAskProject = async (input) => {
3
+ const core = await import("./dist-CFLR5FML.js");
4
+ const { getProjects, ensurePlaygroundProject, checkUserStatus } = core;
5
+ let userId = input.authenticatedUserId;
6
+ let user = input.authenticatedUser;
7
+ if (!userId) {
8
+ const status = await checkUserStatus(input.baseUrl, input.token);
9
+ userId = status.user?.id;
10
+ user = status.user ?? user;
11
+ }
12
+ if (!userId) {
13
+ throw new Error(
14
+ "Could not determine the authenticated user. Run `cloudeval login` and retry."
15
+ );
16
+ }
17
+ const projects = await getProjects(input.baseUrl, input.token, userId);
18
+ if (input.selectedProjectId) {
19
+ const match = projects.find((project) => project.id === input.selectedProjectId);
20
+ if (!match) {
21
+ throw new Error(
22
+ `Project ${input.selectedProjectId} was not found for authenticated user ${userId}. Run \`cloudeval projects list\` to choose a visible project.`
23
+ );
24
+ }
25
+ return match;
26
+ }
27
+ const playground = projects.find((project) => project.name === "Playground");
28
+ if (playground) {
29
+ return playground;
30
+ }
31
+ if (user?.email) {
32
+ return ensurePlaygroundProject(input.baseUrl, input.token, {
33
+ id: userId,
34
+ email: user.email,
35
+ full_name: user.full_name ?? void 0,
36
+ name: user.name ?? void 0
37
+ });
38
+ }
39
+ const fallback = projects[0];
40
+ if (fallback) {
41
+ return fallback;
42
+ }
43
+ throw new Error(
44
+ "No project is available for this account. Run `cloudeval chat` to complete onboarding, then retry."
45
+ );
46
+ };
47
+ export {
48
+ resolveAskProject
49
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ganakailabs/cloudeval-cli",
3
- "version": "0.24.4",
3
+ "version": "0.25.0",
4
4
  "license": "LicenseRef-CloudEval-CLI",
5
5
  "type": "module",
6
6
  "description": "CloudEval CLI for cloud architecture, cost, report, automation, and MCP workflows.",
package/sbom.spdx.json CHANGED
@@ -14,7 +14,7 @@
14
14
  {
15
15
  "SPDXID": "SPDXRef-Package-CloudEval-CLI",
16
16
  "name": "CloudEval CLI",
17
- "versionInfo": "0.24.4",
17
+ "versionInfo": "0.25.0",
18
18
  "downloadLocation": "https://github.com/ganakailabs/cloudeval-cli",
19
19
  "filesAnalyzed": false,
20
20
  "licenseConcluded": "LicenseRef-CloudEval-CLI",