@alwaysmeticulous/cli 2.322.0 → 2.324.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/commands/agent/agent-review-writes.command.spec.d.ts +2 -0
- package/dist/commands/agent/agent-review-writes.command.spec.d.ts.map +1 -0
- package/dist/commands/agent/agent-review-writes.command.spec.js +96 -0
- package/dist/commands/agent/agent-review-writes.command.spec.js.map +1 -0
- package/dist/commands/agent/create-diff-comment.command.d.ts +13 -0
- package/dist/commands/agent/create-diff-comment.command.d.ts.map +1 -0
- package/dist/commands/agent/create-diff-comment.command.js +57 -0
- package/dist/commands/agent/create-diff-comment.command.js.map +1 -0
- package/dist/commands/agent/diff-comment-write.utils.d.ts +13 -0
- package/dist/commands/agent/diff-comment-write.utils.d.ts.map +1 -0
- package/dist/commands/agent/diff-comment-write.utils.js +19 -0
- package/dist/commands/agent/diff-comment-write.utils.js.map +1 -0
- package/dist/commands/agent/diff-comments.command.d.ts.map +1 -1
- package/dist/commands/agent/diff-comments.command.js +15 -4
- package/dist/commands/agent/diff-comments.command.js.map +1 -1
- package/dist/commands/agent/diff-comments.command.spec.js +29 -4
- package/dist/commands/agent/diff-comments.command.spec.js.map +1 -1
- package/dist/commands/agent/ignore-diff.command.d.ts +13 -0
- package/dist/commands/agent/ignore-diff.command.d.ts.map +1 -0
- package/dist/commands/agent/ignore-diff.command.js +54 -0
- package/dist/commands/agent/ignore-diff.command.js.map +1 -0
- package/dist/commands/agent/index.d.ts.map +1 -1
- package/dist/commands/agent/index.js +16 -6
- package/dist/commands/agent/index.js.map +1 -1
- package/dist/commands/agent/js-coverage.command.d.ts +2 -2
- package/dist/commands/agent/js-coverage.command.d.ts.map +1 -1
- package/dist/commands/agent/js-coverage.command.js +6 -5
- package/dist/commands/agent/js-coverage.command.js.map +1 -1
- package/dist/commands/agent/js-coverage.command.spec.js +7 -6
- package/dist/commands/agent/js-coverage.command.spec.js.map +1 -1
- package/dist/commands/agent/reject-diff.command.d.ts +13 -0
- package/dist/commands/agent/reject-diff.command.d.ts.map +1 -0
- package/dist/commands/agent/reject-diff.command.js +54 -0
- package/dist/commands/agent/reject-diff.command.js.map +1 -0
- package/dist/commands/agent/reject-diff.command.spec.d.ts +2 -0
- package/dist/commands/agent/reject-diff.command.spec.d.ts.map +1 -0
- package/dist/commands/agent/reject-diff.command.spec.js +61 -0
- package/dist/commands/agent/reject-diff.command.spec.js.map +1 -0
- package/dist/commands/agent/reply-to-diff-comment.command.d.ts +10 -0
- package/dist/commands/agent/reply-to-diff-comment.command.d.ts.map +1 -0
- package/dist/commands/agent/reply-to-diff-comment.command.js +47 -0
- package/dist/commands/agent/reply-to-diff-comment.command.js.map +1 -0
- package/dist/commands/agent/sessions.command.d.ts +3 -0
- package/dist/commands/agent/sessions.command.d.ts.map +1 -1
- package/dist/commands/agent/sessions.command.js +46 -5
- package/dist/commands/agent/sessions.command.js.map +1 -1
- package/dist/commands/agent/sessions.command.spec.js +30 -7
- package/dist/commands/agent/sessions.command.spec.js.map +1 -1
- package/dist/commands/agent/test-run-checks.command.d.ts +15 -0
- package/dist/commands/agent/test-run-checks.command.d.ts.map +1 -0
- package/dist/commands/agent/test-run-checks.command.js +121 -0
- package/dist/commands/agent/test-run-checks.command.js.map +1 -0
- package/dist/commands/agent/test-run-checks.command.spec.d.ts +2 -0
- package/dist/commands/agent/test-run-checks.command.spec.d.ts.map +1 -0
- package/dist/commands/agent/test-run-checks.command.spec.js +132 -0
- package/dist/commands/agent/test-run-checks.command.spec.js.map +1 -0
- package/dist/commands/agent/test-run-diffs.command.d.ts +1 -0
- package/dist/commands/agent/test-run-diffs.command.d.ts.map +1 -1
- package/dist/commands/agent/test-run-diffs.command.js +32 -40
- package/dist/commands/agent/test-run-diffs.command.js.map +1 -1
- package/dist/commands/agent/test-run-diffs.command.spec.js +114 -52
- package/dist/commands/agent/test-run-diffs.command.spec.js.map +1 -1
- package/dist/commands/agent/test-run-diffs.utils.d.ts +1 -2
- package/dist/commands/agent/test-run-diffs.utils.d.ts.map +1 -1
- package/dist/commands/agent/test-run-diffs.utils.js +6 -7
- package/dist/commands/agent/test-run-diffs.utils.js.map +1 -1
- package/dist/commands/agent/test-run-diffs.utils.spec.js +7 -10
- package/dist/commands/agent/test-run-diffs.utils.spec.js.map +1 -1
- package/dist/commands/agent/test-run-for-commit.command.d.ts.map +1 -1
- package/dist/commands/agent/test-run-for-commit.command.js +5 -4
- package/dist/commands/agent/test-run-for-commit.command.js.map +1 -1
- package/dist/commands/auth/__tests__/get-project.command.spec.js +48 -42
- package/dist/commands/auth/__tests__/get-project.command.spec.js.map +1 -1
- package/dist/commands/auth/__tests__/list-projects.command.spec.js +11 -10
- package/dist/commands/auth/__tests__/list-projects.command.spec.js.map +1 -1
- package/dist/commands/auth/__tests__/set-project.command.spec.js +6 -7
- package/dist/commands/auth/__tests__/set-project.command.spec.js.map +1 -1
- package/dist/commands/auth/__tests__/whoami.command.spec.js +77 -124
- package/dist/commands/auth/__tests__/whoami.command.spec.js.map +1 -1
- package/dist/commands/auth/get-project.command.d.ts +6 -2
- package/dist/commands/auth/get-project.command.d.ts.map +1 -1
- package/dist/commands/auth/get-project.command.js +25 -24
- package/dist/commands/auth/get-project.command.js.map +1 -1
- package/dist/commands/auth/list-projects.command.d.ts.map +1 -1
- package/dist/commands/auth/list-projects.command.js +4 -8
- package/dist/commands/auth/list-projects.command.js.map +1 -1
- package/dist/commands/auth/set-project.command.d.ts +1 -0
- package/dist/commands/auth/set-project.command.d.ts.map +1 -1
- package/dist/commands/auth/set-project.command.js +22 -9
- package/dist/commands/auth/set-project.command.js.map +1 -1
- package/dist/commands/auth/whoami.command.d.ts.map +1 -1
- package/dist/commands/auth/whoami.command.js +94 -87
- package/dist/commands/auth/whoami.command.js.map +1 -1
- package/dist/commands/ci/run-with-uploaded-asset-chunks.command.d.ts.map +1 -1
- package/dist/commands/ci/run-with-uploaded-asset-chunks.command.js +22 -14
- package/dist/commands/ci/run-with-uploaded-asset-chunks.command.js.map +1 -1
- package/dist/commands/ci/run.command.d.ts.map +1 -1
- package/dist/commands/ci/run.command.js +6 -4
- package/dist/commands/ci/run.command.js.map +1 -1
- package/dist/commands/record/__tests__/backend.command.spec.js +54 -4
- package/dist/commands/record/__tests__/backend.command.spec.js.map +1 -1
- package/dist/commands/record/backend.command.d.ts.map +1 -1
- package/dist/commands/record/backend.command.js +196 -100
- package/dist/commands/record/backend.command.js.map +1 -1
- package/dist/utils/__tests__/project-selection-hint.spec.d.ts +2 -0
- package/dist/utils/__tests__/project-selection-hint.spec.d.ts.map +1 -0
- package/dist/utils/__tests__/project-selection-hint.spec.js +73 -0
- package/dist/utils/__tests__/project-selection-hint.spec.js.map +1 -0
- package/dist/utils/__tests__/resolve-project-identifier.spec.js +2 -27
- package/dist/utils/__tests__/resolve-project-identifier.spec.js.map +1 -1
- package/dist/utils/__tests__/resolve-test-run-from-commit.spec.js +9 -2
- package/dist/utils/__tests__/resolve-test-run-from-commit.spec.js.map +1 -1
- package/dist/utils/__tests__/select-project.spec.js +23 -22
- package/dist/utils/__tests__/select-project.spec.js.map +1 -1
- package/dist/utils/handle-auth-failure.d.ts +27 -0
- package/dist/utils/handle-auth-failure.d.ts.map +1 -1
- package/dist/utils/handle-auth-failure.js +44 -3
- package/dist/utils/handle-auth-failure.js.map +1 -1
- package/dist/utils/project-selection-hint.d.ts +16 -0
- package/dist/utils/project-selection-hint.d.ts.map +1 -0
- package/dist/utils/project-selection-hint.js +82 -0
- package/dist/utils/project-selection-hint.js.map +1 -0
- package/dist/utils/resolve-project-identifier.d.ts +0 -13
- package/dist/utils/resolve-project-identifier.d.ts.map +1 -1
- package/dist/utils/resolve-project-identifier.js +3 -26
- package/dist/utils/resolve-project-identifier.js.map +1 -1
- package/dist/utils/resolve-test-run-from-commit.d.ts.map +1 -1
- package/dist/utils/resolve-test-run-from-commit.js +7 -3
- package/dist/utils/resolve-test-run-from-commit.js.map +1 -1
- package/dist/utils/select-project.d.ts +20 -4
- package/dist/utils/select-project.d.ts.map +1 -1
- package/dist/utils/select-project.js +39 -13
- package/dist/utils/select-project.js.map +1 -1
- package/package.json +14 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="42cf5a0a-a974-5f19-a984-dbab1288a84c")}catch(e){}}();
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
const vitest_1 = require("vitest");
|
|
@@ -7,23 +7,24 @@ const cli_user_error_1 = require("../cli-user-error");
|
|
|
7
7
|
const select_project_1 = require("../select-project");
|
|
8
8
|
const mocks = vitest_1.vi.hoisted(() => ({
|
|
9
9
|
getOAuthProjects: vitest_1.vi.fn(),
|
|
10
|
-
|
|
10
|
+
setAgentCurrentProject: vitest_1.vi.fn(),
|
|
11
|
+
getAgentProjects: vitest_1.vi.fn(),
|
|
11
12
|
getOAuthDefaultProject: vitest_1.vi.fn(),
|
|
12
13
|
isFetchError: vitest_1.vi.fn(() => false),
|
|
13
14
|
prompt: vitest_1.vi.fn(),
|
|
14
15
|
}));
|
|
15
16
|
vitest_1.vi.mock("@alwaysmeticulous/client", () => ({
|
|
16
17
|
getOAuthProjects: mocks.getOAuthProjects,
|
|
17
|
-
|
|
18
|
+
setAgentCurrentProject: mocks.setAgentCurrentProject,
|
|
19
|
+
getAgentProjects: mocks.getAgentProjects,
|
|
18
20
|
getOAuthDefaultProject: mocks.getOAuthDefaultProject,
|
|
19
21
|
isFetchError: mocks.isFetchError,
|
|
20
22
|
}));
|
|
21
23
|
// The backend resolves the identifier and returns the resolved project; model
|
|
22
24
|
// that here.
|
|
23
25
|
const resolved = (org, name, id) => ({
|
|
26
|
+
project: `${org}/${name}`,
|
|
24
27
|
projectId: id,
|
|
25
|
-
name,
|
|
26
|
-
organization: { id: `${org}-id`, name: org },
|
|
27
28
|
});
|
|
28
29
|
vitest_1.vi.mock("@alwaysmeticulous/common", () => ({
|
|
29
30
|
logNotice: vitest_1.vi.fn(),
|
|
@@ -42,27 +43,27 @@ const fakeClient = {};
|
|
|
42
43
|
(0, vitest_1.it)("sends an explicit identifier to the backend verbatim (not matched client-side)", async () => {
|
|
43
44
|
// A bare name, id, or slug all go straight to the backend, which resolves
|
|
44
45
|
// flexibly and returns the resolved project.
|
|
45
|
-
mocks.
|
|
46
|
+
mocks.setAgentCurrentProject.mockResolvedValue(resolved("OrgB", "App2", "id-2"));
|
|
46
47
|
const result = await (0, select_project_1.selectAndStoreProject)({
|
|
47
48
|
client: fakeClient,
|
|
48
49
|
project: "App2",
|
|
49
50
|
});
|
|
50
|
-
(0, vitest_1.expect)(result).
|
|
51
|
-
(0, vitest_1.expect)(mocks.
|
|
51
|
+
(0, vitest_1.expect)(result).toEqual({ project: "OrgB/App2", projectId: "id-2" });
|
|
52
|
+
(0, vitest_1.expect)(mocks.setAgentCurrentProject).toHaveBeenCalledWith(fakeClient, "App2");
|
|
52
53
|
// No client-side project listing for an explicit identifier.
|
|
53
54
|
(0, vitest_1.expect)(mocks.getOAuthProjects).not.toHaveBeenCalled();
|
|
54
55
|
});
|
|
55
56
|
(0, vitest_1.it)("trims surrounding whitespace from the provided identifier", async () => {
|
|
56
|
-
mocks.
|
|
57
|
+
mocks.setAgentCurrentProject.mockResolvedValue(resolved("OrgA", "App1", "id-1"));
|
|
57
58
|
const result = await (0, select_project_1.selectAndStoreProject)({
|
|
58
59
|
client: fakeClient,
|
|
59
60
|
project: " OrgA/App1 ",
|
|
60
61
|
});
|
|
61
|
-
(0, vitest_1.expect)(result).
|
|
62
|
-
(0, vitest_1.expect)(mocks.
|
|
62
|
+
(0, vitest_1.expect)(result).toEqual({ project: "OrgA/App1", projectId: "id-1" });
|
|
63
|
+
(0, vitest_1.expect)(mocks.setAgentCurrentProject).toHaveBeenCalledWith(fakeClient, "OrgA/App1");
|
|
63
64
|
});
|
|
64
65
|
(0, vitest_1.it)("throws with the available list when the backend can't resolve the identifier", async () => {
|
|
65
|
-
mocks.
|
|
66
|
+
mocks.setAgentCurrentProject.mockRejectedValueOnce(new Error("not found"));
|
|
66
67
|
mocks.getOAuthProjects.mockResolvedValue([project("OrgA", "App1", "id-1")]);
|
|
67
68
|
await (0, vitest_1.expect)((0, select_project_1.selectAndStoreProject)({
|
|
68
69
|
client: fakeClient,
|
|
@@ -74,8 +75,8 @@ const fakeClient = {};
|
|
|
74
75
|
const result = await (0, select_project_1.selectAndStoreProject)({
|
|
75
76
|
client: fakeClient,
|
|
76
77
|
});
|
|
77
|
-
(0, vitest_1.expect)(result).
|
|
78
|
-
(0, vitest_1.expect)(mocks.
|
|
78
|
+
(0, vitest_1.expect)(result).toEqual({ project: "OrgA/App1", projectId: "id-1" });
|
|
79
|
+
(0, vitest_1.expect)(mocks.setAgentCurrentProject).toHaveBeenCalledWith(fakeClient, "id-1");
|
|
79
80
|
});
|
|
80
81
|
(0, vitest_1.it)("throws when no projects are accessible", async () => {
|
|
81
82
|
mocks.getOAuthProjects.mockResolvedValue([]);
|
|
@@ -93,7 +94,7 @@ const fakeClient = {};
|
|
|
93
94
|
(0, vitest_1.expect)(caught).toBeInstanceOf(cli_user_error_1.CliUserError);
|
|
94
95
|
(0, vitest_1.expect)(caught.severity).toBe("warn");
|
|
95
96
|
(0, vitest_1.expect)(caught.exitCode).toBe(1);
|
|
96
|
-
(0, vitest_1.expect)(mocks.
|
|
97
|
+
(0, vitest_1.expect)(mocks.setAgentCurrentProject).not.toHaveBeenCalled();
|
|
97
98
|
});
|
|
98
99
|
});
|
|
99
100
|
(0, vitest_1.describe)("selectProjectOnLogin", () => {
|
|
@@ -101,18 +102,18 @@ const fakeClient = {};
|
|
|
101
102
|
vitest_1.vi.clearAllMocks();
|
|
102
103
|
});
|
|
103
104
|
(0, vitest_1.it)("persists an explicit --project (resolved by the backend)", async () => {
|
|
104
|
-
mocks.
|
|
105
|
+
mocks.setAgentCurrentProject.mockResolvedValue(resolved("OrgB", "App2", "id-2"));
|
|
105
106
|
await (0, select_project_1.selectProjectOnLogin)({
|
|
106
107
|
client: fakeClient,
|
|
107
108
|
project: "OrgB/App2",
|
|
108
109
|
interactive: true,
|
|
109
110
|
});
|
|
110
|
-
(0, vitest_1.expect)(mocks.
|
|
111
|
+
(0, vitest_1.expect)(mocks.setAgentCurrentProject).toHaveBeenCalledWith(fakeClient, "OrgB/App2");
|
|
111
112
|
});
|
|
112
113
|
(0, vitest_1.it)("auto-selects and persists the sole project (no stored-default lookup needed)", async () => {
|
|
113
114
|
mocks.getOAuthProjects.mockResolvedValue([project("OrgA", "App1", "id-1")]);
|
|
114
115
|
await (0, select_project_1.selectProjectOnLogin)({ client: fakeClient, interactive: true });
|
|
115
|
-
(0, vitest_1.expect)(mocks.
|
|
116
|
+
(0, vitest_1.expect)(mocks.setAgentCurrentProject).toHaveBeenCalledWith(fakeClient, "id-1");
|
|
116
117
|
// Only >1-project accounts consult the stored default (to respect it);
|
|
117
118
|
// a sole project is selected directly.
|
|
118
119
|
(0, vitest_1.expect)(mocks.getOAuthDefaultProject).not.toHaveBeenCalled();
|
|
@@ -128,7 +129,7 @@ const fakeClient = {};
|
|
|
128
129
|
organization: { id: "OrgB-id", name: "OrgB" },
|
|
129
130
|
});
|
|
130
131
|
await (0, select_project_1.selectProjectOnLogin)({ client: fakeClient, interactive: false });
|
|
131
|
-
(0, vitest_1.expect)(mocks.
|
|
132
|
+
(0, vitest_1.expect)(mocks.setAgentCurrentProject).not.toHaveBeenCalled();
|
|
132
133
|
});
|
|
133
134
|
(0, vitest_1.it)("succeeds non-interactively when a default already exists, even with multiple projects", async () => {
|
|
134
135
|
mocks.getOAuthProjects.mockResolvedValue([
|
|
@@ -153,7 +154,7 @@ const fakeClient = {};
|
|
|
153
154
|
interactive: false,
|
|
154
155
|
}).catch((error) => error);
|
|
155
156
|
(0, vitest_1.expect)(caught).toBeInstanceOf(cli_user_error_1.CliUserError);
|
|
156
|
-
(0, vitest_1.expect)(mocks.
|
|
157
|
+
(0, vitest_1.expect)(mocks.setAgentCurrentProject).not.toHaveBeenCalled();
|
|
157
158
|
});
|
|
158
159
|
(0, vitest_1.it)("prompts and persists when interactive with several projects and no default", async () => {
|
|
159
160
|
mocks.getOAuthProjects.mockResolvedValue([
|
|
@@ -163,7 +164,7 @@ const fakeClient = {};
|
|
|
163
164
|
mocks.getOAuthDefaultProject.mockResolvedValue({ projectId: null });
|
|
164
165
|
mocks.prompt.mockResolvedValue({ projectId: "id-2" });
|
|
165
166
|
await (0, select_project_1.selectProjectOnLogin)({ client: fakeClient, interactive: true });
|
|
166
|
-
(0, vitest_1.expect)(mocks.
|
|
167
|
+
(0, vitest_1.expect)(mocks.setAgentCurrentProject).toHaveBeenCalledWith(fakeClient, "id-2");
|
|
167
168
|
});
|
|
168
169
|
});
|
|
169
170
|
(0, vitest_1.describe)("formatProjectSlug", () => {
|
|
@@ -211,4 +212,4 @@ const fakeClient = {};
|
|
|
211
212
|
});
|
|
212
213
|
});
|
|
213
214
|
//# sourceMappingURL=select-project.spec.js.map
|
|
214
|
-
//# debugId=
|
|
215
|
+
//# debugId=42cf5a0a-a974-5f19-a984-dbab1288a84c
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-project.spec.js","sources":["../../../src/utils/__tests__/select-project.spec.ts"],"sourceRoot":"","names":[],"mappings":";;;;AAAA,mCAA8D;AAC9D,sDAAiD;AACjD,sDAK2B;AAE3B,MAAM,KAAK,GAAG,WAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC9B,gBAAgB,EAAE,W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C;QAEnD,MAAM,IAAA,wCAAuB,EAAC,UAAU,CAAC,CAAC;QAE1C,IAAA,eAAM,EAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","debugId":"42cf5a0a-a974-5f19-a984-dbab1288a84c"}
|
|
@@ -17,5 +17,32 @@
|
|
|
17
17
|
* try { ... } catch (error) { handleAuthFailure(error); throw error; }
|
|
18
18
|
*/
|
|
19
19
|
export declare const handleAuthFailure: (error: unknown) => false;
|
|
20
|
+
/**
|
|
21
|
+
* Re-presents a backend rejection as a `CliUserError` carrying the server's own
|
|
22
|
+
* message, so `wrapHandler` prints that message and exits non-zero instead of
|
|
23
|
+
* dumping a fetch error and stack. Use for endpoints whose 4xx bodies are
|
|
24
|
+
* written for the user (e.g. "no default project is set ..." — the backend is
|
|
25
|
+
* the only side that knows *why*, and duplicating that reasoning in the CLI is
|
|
26
|
+
* how the two drift apart). Returns the error unchanged when it carries no
|
|
27
|
+
* message, so genuine transport failures keep their original diagnostics.
|
|
28
|
+
*
|
|
29
|
+
* Deliberately narrowed to `400` rather than "any fetch error with a message":
|
|
30
|
+
* every business rejection these agent endpoints throw for a user to read is a
|
|
31
|
+
* `400` (see `AgentAccountService`'s `BadRequestException`/`AgentReasonedHttpException`
|
|
32
|
+
* throws). A `404` can just as easily mean the route itself doesn't exist (an
|
|
33
|
+
* older backend than this CLI) and a `5xx` is always a real defect — converting
|
|
34
|
+
* those into a `CliUserError` here would stop them reaching Sentry and hide the
|
|
35
|
+
* status/body that would explain them.
|
|
36
|
+
*/
|
|
37
|
+
export declare const toServerMessageError: (error: unknown) => unknown;
|
|
38
|
+
/**
|
|
39
|
+
* Whether `error` is Nest's default response for a request that matched no
|
|
40
|
+
* route at all (as opposed to a route that matched and rejected the request) —
|
|
41
|
+
* e.g. `{"statusCode":404,"message":"Cannot PUT /api/agent/project", "error":"Not Found"}`.
|
|
42
|
+
* Distinguishes "this CLI is newer than the backend it's talking to" from a
|
|
43
|
+
* genuine, intentionally-thrown 404 (like "project not found"), which callers
|
|
44
|
+
* must not conflate — see `toProjectResolutionError` in `select-project.ts`.
|
|
45
|
+
*/
|
|
46
|
+
export declare const isRouteNotFoundError: (error: unknown) => boolean;
|
|
20
47
|
export declare const extractServerMessage: (data: unknown) => string | null;
|
|
21
48
|
//# sourceMappingURL=handle-auth-failure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-auth-failure.d.ts","sourceRoot":"","sources":["../../src/utils/handle-auth-failure.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,UAAW,OAAO,KAAG,KAiClD,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,OAAO,KAAG,MAAM,GAAG,IAc7D,CAAC"}
|
|
1
|
+
{"version":3,"file":"handle-auth-failure.d.ts","sourceRoot":"","sources":["../../src/utils/handle-auth-failure.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,UAAW,OAAO,KAAG,KAiClD,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,UAAW,OAAO,KAAG,OAMrD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,UAAW,OAAO,KAAG,OAMrD,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,OAAO,KAAG,MAAM,GAAG,IAc7D,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f0f87b64-3b10-5f7f-a980-1406b84c4928")}catch(e){}}();
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.extractServerMessage = exports.handleAuthFailure = void 0;
|
|
5
|
+
exports.extractServerMessage = exports.isRouteNotFoundError = exports.toServerMessageError = exports.handleAuthFailure = void 0;
|
|
6
6
|
const client_1 = require("@alwaysmeticulous/client");
|
|
7
7
|
const cli_user_error_1 = require("./cli-user-error");
|
|
8
8
|
/**
|
|
@@ -47,6 +47,47 @@ const handleAuthFailure = (error) => {
|
|
|
47
47
|
"If the token is stale, run `meticulous auth logout` and re-run the command.");
|
|
48
48
|
};
|
|
49
49
|
exports.handleAuthFailure = handleAuthFailure;
|
|
50
|
+
/**
|
|
51
|
+
* Re-presents a backend rejection as a `CliUserError` carrying the server's own
|
|
52
|
+
* message, so `wrapHandler` prints that message and exits non-zero instead of
|
|
53
|
+
* dumping a fetch error and stack. Use for endpoints whose 4xx bodies are
|
|
54
|
+
* written for the user (e.g. "no default project is set ..." — the backend is
|
|
55
|
+
* the only side that knows *why*, and duplicating that reasoning in the CLI is
|
|
56
|
+
* how the two drift apart). Returns the error unchanged when it carries no
|
|
57
|
+
* message, so genuine transport failures keep their original diagnostics.
|
|
58
|
+
*
|
|
59
|
+
* Deliberately narrowed to `400` rather than "any fetch error with a message":
|
|
60
|
+
* every business rejection these agent endpoints throw for a user to read is a
|
|
61
|
+
* `400` (see `AgentAccountService`'s `BadRequestException`/`AgentReasonedHttpException`
|
|
62
|
+
* throws). A `404` can just as easily mean the route itself doesn't exist (an
|
|
63
|
+
* older backend than this CLI) and a `5xx` is always a real defect — converting
|
|
64
|
+
* those into a `CliUserError` here would stop them reaching Sentry and hide the
|
|
65
|
+
* status/body that would explain them.
|
|
66
|
+
*/
|
|
67
|
+
const toServerMessageError = (error) => {
|
|
68
|
+
if (!(0, client_1.isFetchError)(error) || error.response?.status !== 400) {
|
|
69
|
+
return error;
|
|
70
|
+
}
|
|
71
|
+
const message = (0, exports.extractServerMessage)(error.response?.data);
|
|
72
|
+
return message ? new cli_user_error_1.CliUserError(message) : error;
|
|
73
|
+
};
|
|
74
|
+
exports.toServerMessageError = toServerMessageError;
|
|
75
|
+
/**
|
|
76
|
+
* Whether `error` is Nest's default response for a request that matched no
|
|
77
|
+
* route at all (as opposed to a route that matched and rejected the request) —
|
|
78
|
+
* e.g. `{"statusCode":404,"message":"Cannot PUT /api/agent/project", "error":"Not Found"}`.
|
|
79
|
+
* Distinguishes "this CLI is newer than the backend it's talking to" from a
|
|
80
|
+
* genuine, intentionally-thrown 404 (like "project not found"), which callers
|
|
81
|
+
* must not conflate — see `toProjectResolutionError` in `select-project.ts`.
|
|
82
|
+
*/
|
|
83
|
+
const isRouteNotFoundError = (error) => {
|
|
84
|
+
if (!(0, client_1.isFetchError)(error) || error.response?.status !== 404) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
const message = (0, exports.extractServerMessage)(error.response?.data);
|
|
88
|
+
return message != null && /^Cannot [A-Z]+ /.test(message);
|
|
89
|
+
};
|
|
90
|
+
exports.isRouteNotFoundError = isRouteNotFoundError;
|
|
50
91
|
const extractServerMessage = (data) => {
|
|
51
92
|
if (!data) {
|
|
52
93
|
return null;
|
|
@@ -64,4 +105,4 @@ const extractServerMessage = (data) => {
|
|
|
64
105
|
};
|
|
65
106
|
exports.extractServerMessage = extractServerMessage;
|
|
66
107
|
//# sourceMappingURL=handle-auth-failure.js.map
|
|
67
|
-
//# debugId=
|
|
108
|
+
//# debugId=f0f87b64-3b10-5f7f-a980-1406b84c4928
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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AAoB,GAAG,CAAC,IAAa,EAAiB,EAAE;IACnE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAI,IAA8B,CAAC,OAAO,CAAC;QACxD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAdW,QAAA,oBAAoB,wBAc/B","debugId":"
|
|
1
|
+
{"version":3,"file":"handle-auth-failure.js","sources":["../../src/utils/handle-auth-failure.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAAA,qDAOkC;AAClC,qDAAgD;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAS,EAAE;IACzD,IAAI,CAAC,IAAA,qBAAY,EAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC;IACtC,IAAI,CAAC,IAAA,4BAAmB,EAAC,MAAM,CAAC,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,6BAAoB,GAAE,CAAC;IACtC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,IAAA,qBAAY,EAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAElE,IAAI,OAAO,EAAE,CAAC;QACZ,IAAA,yBAAgB,GAAE,CAAC;QACnB,MAAM,IAAI,6BAAY,CACpB,kEAAkE;YAChE,4CAA4C,CAC/C,CAAC;IACJ,CA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3D,OAAO,OAAO,IAAI,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC5D,CAAC,CAAC;AANW,QAAA,oBAAoB,wBAM/B;AAEK,MAAM,oBAAoB,GAAG,CAAC,IAAa,EAAiB,EAAE;IACnE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAI,IAA8B,CAAC,OAAO,CAAC;QACxD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAdW,QAAA,oBAAoB,wBAc/B","debugId":"f0f87b64-3b10-5f7f-a980-1406b84c4928"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MeticulousClient } from "@alwaysmeticulous/client";
|
|
2
|
+
/**
|
|
3
|
+
* Appends guidance to an empty/not-found result from a project-scoped command,
|
|
4
|
+
* naming the project the lookup actually ran against and how to change it. An
|
|
5
|
+
* empty-handed lookup is far more often a wrong-project mismatch than a genuine
|
|
6
|
+
* absence — a default project is stored server-side, so it is shared across
|
|
7
|
+
* every machine and the hosted MCP server, and drifts without any local signal.
|
|
8
|
+
* Returns `message` unchanged when `project` was passed explicitly: the caller
|
|
9
|
+
* already chose the project, so there is nothing to disambiguate.
|
|
10
|
+
*
|
|
11
|
+
* Best-effort and never throws: the resolution is one extra request on a path
|
|
12
|
+
* that has already failed, so a failure to describe the selection just falls
|
|
13
|
+
* back to naming the commands rather than the project.
|
|
14
|
+
*/
|
|
15
|
+
export declare const appendProjectSelectionHint: (message: string, client: MeticulousClient, project: string | undefined) => Promise<string>;
|
|
16
|
+
//# sourceMappingURL=project-selection-hint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-selection-hint.d.ts","sourceRoot":"","sources":["../../src/utils/project-selection-hint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAelC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,YAC5B,MAAM,UACP,gBAAgB,WACf,MAAM,GAAG,SAAS,KAC1B,OAAO,CAAC,MAAM,CAGhB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="19ab7503-45b7-57ed-b38a-297e407b0041")}catch(e){}}();
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.appendProjectSelectionHint = void 0;
|
|
6
|
+
const client_1 = require("@alwaysmeticulous/client");
|
|
7
|
+
/**
|
|
8
|
+
* Appends guidance to an empty/not-found result from a project-scoped command,
|
|
9
|
+
* naming the project the lookup actually ran against and how to change it. An
|
|
10
|
+
* empty-handed lookup is far more often a wrong-project mismatch than a genuine
|
|
11
|
+
* absence — a default project is stored server-side, so it is shared across
|
|
12
|
+
* every machine and the hosted MCP server, and drifts without any local signal.
|
|
13
|
+
* Returns `message` unchanged when `project` was passed explicitly: the caller
|
|
14
|
+
* already chose the project, so there is nothing to disambiguate.
|
|
15
|
+
*
|
|
16
|
+
* Best-effort and never throws: the resolution is one extra request on a path
|
|
17
|
+
* that has already failed, so a failure to describe the selection just falls
|
|
18
|
+
* back to naming the commands rather than the project.
|
|
19
|
+
*/
|
|
20
|
+
const appendProjectSelectionHint = async (message, client, project) => {
|
|
21
|
+
const hint = await describeProjectSelection(client, project);
|
|
22
|
+
return hint ? `${message} ${hint}` : message;
|
|
23
|
+
};
|
|
24
|
+
exports.appendProjectSelectionHint = appendProjectSelectionHint;
|
|
25
|
+
const describeProjectSelection = async (client, project) => {
|
|
26
|
+
if (project != null && project.trim() !== "") {
|
|
27
|
+
return "";
|
|
28
|
+
}
|
|
29
|
+
const selection = await resolveProjectSelection(client);
|
|
30
|
+
switch (selection.source) {
|
|
31
|
+
case "default":
|
|
32
|
+
return (`Searched project ${selection.slug} — your default project, since no --project was given. ` +
|
|
33
|
+
"If that is not the project you expected, run `meticulous auth list-projects` to see the " +
|
|
34
|
+
'projects you can access, `meticulous auth set-project` (interactive) or `meticulous auth set-project --project "<org/project>"` ' +
|
|
35
|
+
'to change the default, or pass --project "<org/project>" to override it for a single command.');
|
|
36
|
+
case "auto-picked":
|
|
37
|
+
return (`Searched project ${selection.slug} — automatically selected since it's the only project your ` +
|
|
38
|
+
"account can access, since no --project was given. If that is not the project you expected, run " +
|
|
39
|
+
"`meticulous auth list-projects` to see the projects you can access, " +
|
|
40
|
+
'`meticulous auth set-project --project "<org/project>"` to store an explicit default, or pass ' +
|
|
41
|
+
'--project "<org/project>" to override it for a single command.');
|
|
42
|
+
case "token":
|
|
43
|
+
// Only a project API token with cross-project access can actually use
|
|
44
|
+
// --project (see `ApiTokenService.resolveProjectFromTokenOrRequest`); other
|
|
45
|
+
// project and every test-run token reject it. Worded to be true either way
|
|
46
|
+
// rather than assuming this token can't use it.
|
|
47
|
+
return (`Searched project ${selection.slug}, which your API token is scoped to by default. Pass ` +
|
|
48
|
+
'--project "<org/project>" to search a different project — this only works for a project API ' +
|
|
49
|
+
"token with cross-project access; other tokens are rejected. `meticulous auth set-project` does " +
|
|
50
|
+
"not apply to any API token — to change the default, log in as a user with `meticulous auth login`.");
|
|
51
|
+
case "unknown":
|
|
52
|
+
return ("No --project was given, so this used your default project. Run `meticulous auth get-project` to " +
|
|
53
|
+
"see which project that is, `meticulous auth list-projects` for the projects you can access, and " +
|
|
54
|
+
"`meticulous auth set-project` to change the default.");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Resolves which project the client's credentials target, and how, via a
|
|
59
|
+
* single call to `agent/project` — it already reports this unambiguously for
|
|
60
|
+
* either credential kind (see `AgentAccountService.getCurrentProject`), so
|
|
61
|
+
* there's no need to guess from which of several endpoints happens to answer.
|
|
62
|
+
*/
|
|
63
|
+
const resolveProjectSelection = async (client) => {
|
|
64
|
+
try {
|
|
65
|
+
const current = await (0, client_1.getAgentCurrentProject)(client);
|
|
66
|
+
switch (current.source) {
|
|
67
|
+
case "user-default":
|
|
68
|
+
return { source: "default", slug: current.project };
|
|
69
|
+
case "auto-picked":
|
|
70
|
+
return { source: "auto-picked", slug: current.project };
|
|
71
|
+
case "api-token":
|
|
72
|
+
return { source: "token", slug: current.project };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// Offline, an older backend without this route, no usable default, or
|
|
77
|
+
// credentials injected at request time that this client never sees.
|
|
78
|
+
}
|
|
79
|
+
return { source: "unknown" };
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=project-selection-hint.js.map
|
|
82
|
+
//# debugId=19ab7503-45b7-57ed-b38a-297e407b0041
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-selection-hint.js","sources":["../../src/utils/project-selection-hint.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAAA,qDAGkC;AAelC;;;;;;;;;;;;GAYG;AACI,MAAM,0BAA0B,GAAG,KAAK,EAC7C,OAAe,EACf,MAAwB,EACxB,OAA2B,EACV,EAAE;IACnB,MAAM,IAAI,GAAG,MAAM,wBAAwB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AAC/C,CAAC,CAAC;AAPW,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AO,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1D,KAAK,WAAW;gBACd,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QACtD,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;QACtE,oEAAoE;IACtE,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAC/B,CAAC,CAAC","debugId":"19ab7503-45b7-57ed-b38a-297e407b0041"}
|
|
@@ -15,17 +15,4 @@
|
|
|
15
15
|
export declare const resolveProjectIdentifier: (apiToken: string | null) => Promise<{
|
|
16
16
|
projectId?: string;
|
|
17
17
|
}>;
|
|
18
|
-
/**
|
|
19
|
-
* Resolves the single project a project-scoped API token is bound to, via the
|
|
20
|
-
* `token-info` endpoint, as an `"organization/name"` slug. Best-effort: any
|
|
21
|
-
* failure (network, older backend without the endpoint, etc.) resolves to
|
|
22
|
-
* `null` rather than throwing — used for informational display (`whoami`,
|
|
23
|
-
* `get-project`), where a missing project name shouldn't fail the command.
|
|
24
|
-
*
|
|
25
|
-
* A `null` token sends the request without an Authorization header, which
|
|
26
|
-
* doubles as a probe for environments that inject credentials into outbound
|
|
27
|
-
* requests: it resolves to the pinned project when injection is working and
|
|
28
|
-
* `null` otherwise.
|
|
29
|
-
*/
|
|
30
|
-
export declare const resolvePinnedProjectSlug: (apiToken: string | null) => Promise<string | null>;
|
|
31
18
|
//# sourceMappingURL=resolve-project-identifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-project-identifier.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-project-identifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-project-identifier.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-project-identifier.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,aACzB,MAAM,GAAG,IAAI,KACtB,OAAO,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAiBhC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2fb3a46b-d479-5d7c-a99f-3328558c2975")}catch(e){}}();
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.resolveProjectIdentifier = void 0;
|
|
6
6
|
const common_1 = require("@alwaysmeticulous/common");
|
|
7
7
|
const client_1 = require("@alwaysmeticulous/client");
|
|
8
8
|
const cli_user_error_1 = require("./cli-user-error");
|
|
@@ -36,28 +36,5 @@ const resolveProjectIdentifier = async (apiToken) => {
|
|
|
36
36
|
return { projectId };
|
|
37
37
|
};
|
|
38
38
|
exports.resolveProjectIdentifier = resolveProjectIdentifier;
|
|
39
|
-
/**
|
|
40
|
-
* Resolves the single project a project-scoped API token is bound to, via the
|
|
41
|
-
* `token-info` endpoint, as an `"organization/name"` slug. Best-effort: any
|
|
42
|
-
* failure (network, older backend without the endpoint, etc.) resolves to
|
|
43
|
-
* `null` rather than throwing — used for informational display (`whoami`,
|
|
44
|
-
* `get-project`), where a missing project name shouldn't fail the command.
|
|
45
|
-
*
|
|
46
|
-
* A `null` token sends the request without an Authorization header, which
|
|
47
|
-
* doubles as a probe for environments that inject credentials into outbound
|
|
48
|
-
* requests: it resolves to the pinned project when injection is working and
|
|
49
|
-
* `null` otherwise.
|
|
50
|
-
*/
|
|
51
|
-
const resolvePinnedProjectSlug = async (apiToken) => {
|
|
52
|
-
try {
|
|
53
|
-
const client = (0, client_1.createClient)({ apiToken });
|
|
54
|
-
const project = await (0, client_1.getProject)(client);
|
|
55
|
-
return project ? `${project.organization.name}/${project.name}` : null;
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
exports.resolvePinnedProjectSlug = resolvePinnedProjectSlug;
|
|
62
39
|
//# sourceMappingURL=resolve-project-identifier.js.map
|
|
63
|
-
//# debugId=
|
|
40
|
+
//# debugId=2fb3a46b-d479-5d7c-a99f-3328558c2975
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-project-identifier.js","sources":["../../src/utils/resolve-project-identifier.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAAA,qDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"resolve-project-identifier.js","sources":["../../src/utils/resolve-project-identifier.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAAA,qDAAsD;AACtD,qDAA+E;AAC/E,qDAAgD;AAEhD;;;;;;;;;;;;;GAaG;AACI,MAAM,wBAAwB,GAAG,KAAK,EAC3C,QAAuB,EACU,EAAE;IACnC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAA,mBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;IAC5B,wEAAwE;IACxE,8EAA8E;IAC9E,+DAA+D;IAC/D,MAAM,SAAS,GAAG,MAAM,IAAA,gCAAuB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,6BAAY,CACpB,sEAAsE;YACpE,kDAAkD,CACrD,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,CAAC;AACvB,CAAC,CAAC;AAnBW,QAAA,wBAAwB,4BAmBnC","debugId":"2fb3a46b-d479-5d7c-a99f-3328558c2975"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-test-run-from-commit.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-test-run-from-commit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve-test-run-from-commit.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-test-run-from-commit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAqBjE;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,cACpB,MAAM,GAAG,SAAS,eAChB,MAAM,KAClB,OAAO,CAAC,IAAI,CAQd,CAAC;AAUF,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,WAAY,aAAa,KAAG,OACd,CAAC;AAS/C,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,WAAY,aAAa,KAAG,OACf,CAAC;AAK5C,2EAA2E;AAC3E,eAAO,MAAM,eAAe,WAAY,aAAa,KAAG,OACf,CAAC;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,WAAY,aAAa,KAAG,OACnC,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,cACrB,MAAM,UACT,aAAa,mBACO;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,KAClD,IAgBF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,8BAA8B,WACjC,gBAAgB,aACb,MAAM,GAAG,SAAS,YACnB,MAAM,KACf,OAAO,CAAC,eAAe,CAuBzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,WAC7B,gBAAgB,aACb,MAAM,GAAG,SAAS,YACnB,MAAM,KACf,OAAO,CAAC,eAAe,GAAG,IAAI,CAmBhC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,WACzB,gBAAgB,aACb,MAAM,uBACU;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,KACtD,OAAO,CAAC,aAAa,CAsBvB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,WACxB,gBAAgB,aACb,MAAM,UACT,aAAa,iCAIlB;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,KACjD,OAAO,CAAC,aAAa,GAAG,IAAI,CAM9B,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f9ab1463-8487-58f2-8275-f7c3deeb549e")}catch(e){}}();
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.ensureTestRunFinished = exports.awaitTestRunCompletion = exports.tryResolveTestRunForCommit = exports.resolveTestRunForCommitOrThrow = exports.assertTestRunComplete = exports.isTestRunPartial = exports.isTestRunFailed = exports.isTestRunComplete = exports.isTestRunInProgress = exports.logResolvedCommitSha = void 0;
|
|
6
6
|
const client_1 = require("@alwaysmeticulous/client");
|
|
7
7
|
const common_1 = require("@alwaysmeticulous/common");
|
|
8
8
|
const cli_user_error_1 = require("./cli-user-error");
|
|
9
|
+
const project_selection_hint_1 = require("./project-selection-hint");
|
|
9
10
|
const POLL_INTERVAL_MS = 10_000;
|
|
10
11
|
/** Give up waiting for a run after this long, rather than polling forever. */
|
|
11
12
|
const POLL_TIMEOUT_MS = 10 * 60_000;
|
|
@@ -73,6 +74,9 @@ exports.isTestRunPartial = isTestRunPartial;
|
|
|
73
74
|
* complete, which is true but unhelpful, so intercept it first.
|
|
74
75
|
*/
|
|
75
76
|
const assertTestRunComplete = (testRunId, status, { resultName = "results" } = {}) => {
|
|
77
|
+
if (status === "Skipped") {
|
|
78
|
+
throw new cli_user_error_1.CliUserError(`Test run ${testRunId} was skipped (no base test run was found, so nothing ran); ${resultName} are not available.`);
|
|
79
|
+
}
|
|
76
80
|
if ((0, exports.isTestRunFailed)(status)) {
|
|
77
81
|
throw new cli_user_error_1.CliUserError(`Test run ${testRunId} finished unsuccessfully (status: ${status}).`);
|
|
78
82
|
}
|
|
@@ -103,7 +107,7 @@ const resolveTestRunForCommitOrThrow = async (client, commitSha, project) => {
|
|
|
103
107
|
project,
|
|
104
108
|
});
|
|
105
109
|
if (testRunId == null || status == null) {
|
|
106
|
-
throw new cli_user_error_1.CliUserError(`No test run found for commit ${sha}
|
|
110
|
+
throw new cli_user_error_1.CliUserError(await (0, project_selection_hint_1.appendProjectSelectionHint)(`No test run found for commit ${sha}.`, client, project));
|
|
107
111
|
}
|
|
108
112
|
(0, common_1.logProgress)(`Resolved test run id: ${testRunId}`);
|
|
109
113
|
return { testRunId, status };
|
|
@@ -180,4 +184,4 @@ const ensureTestRunFinished = async (client, testRunId, status, { dontWait, thro
|
|
|
180
184
|
};
|
|
181
185
|
exports.ensureTestRunFinished = ensureTestRunFinished;
|
|
182
186
|
//# sourceMappingURL=resolve-test-run-from-commit.js.map
|
|
183
|
-
//# debugId=
|
|
187
|
+
//# debugId=f9ab1463-8487-58f2-8275-f7c3deeb549e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-test-run-from-commit.js","sources":["../../src/utils/resolve-test-run-from-commit.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAEA,qDAIkC;AAClC,qDAMkC;AAClC,qDAAgD;
|
|
1
|
+
{"version":3,"file":"resolve-test-run-from-commit.js","sources":["../../src/utils/resolve-test-run-from-commit.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAEA,qDAIkC;AAClC,qDAMkC;AAClC,qDAAgD;AAChD,qEAAsE;AAEtE,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC,8EAA8E;AAC9E,MAAM,eAAe,GAAG,EAAE,GAAG,MAAM,CAAC;AAEpC;;;;;;;GAOG;AACI,MAAM,oBAAoB,GAAG,KAAK,EACvC,SAA6B,EAC7B,WAAmB,EACJ,EAAE;IACjB,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;QACtB,IAAA,oBAAW,EAAC,yBAAyB,WAAW,EAAE,CAAC,CAAC;IACtD,CAAC;SAAM,IAAI,MAAM,eAAe,EAAE,EAAE,CAAC;QACnC,IAAA,kBAAS,EAAC,uCAAuC,WAAW,EAAE,CAAC,CAAC;IAClE,CAAC;SAAM,CAAC;QACN,IAAA,oBAAW,EAAC,sBAAsB,WAAW,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,oBAAoB,wBAW/B;AAEF;;;;GAIG;AACH,MAAM,eAAe,GAAG,KAAK,IAAsB,EAAE,CACnD,CAAC,MAAM,IAAA,8BAAqB,GAAE,CAAC,IAAI,CAAC,MAAM,IAAA,0BAAiB,GAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAO5E,wEAAwE;AACjE,MAAM,mBAAmB,G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,mBAAU,EAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACpD,CAAC;IACD,IAAI,cAAc,IAAI,IAAA,uBAAe,EAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,6BAAY,CACpB,YAAY,SAAS,qCAAqC,OAAO,CAAC,MAAM,IAAI,CAC7E,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC,CAAC;AA1BW,QAAA,sBAAsB,0BA0BjC;AAEF;;;;;;GAMG;AACI,MAAM,qBAAqB,GAAG,KAAK,EACxC,MAAwB,EACxB,SAAiB,EACjB,MAAqB,EACrB,EACE,QAAQ,EACR,cAAc,GAAG,IAAI,GAC2B,EACnB,EAAE;IACjC,IAAI,QAAQ,IAAI,IAAA,2BAAmB,EAAC,MAAM,CAAC,EAAE,CAAC;QAC5C,IAAA,kBAAS,EAAC,YAAY,SAAS,6BAA6B,MAAM,IAAI,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAA,8BAAsB,EAAC,MAAM,EAAE,SAAS,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;AACvE,CAAC,CAAC;AAdW,QAAA,qBAAqB,yBAchC","debugId":"f9ab1463-8487-58f2-8275-f7c3deeb549e"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MeticulousClient, OAuthDefaultProjectResponse, OAuthProject } from "@alwaysmeticulous/client";
|
|
1
|
+
import type { AgentProjectListItem, MeticulousClient, OAuthDefaultProjectResponse, OAuthProject } from "@alwaysmeticulous/client";
|
|
2
2
|
/**
|
|
3
3
|
* Fetches the projects accessible to the OAuth caller, surfacing auth failures
|
|
4
4
|
* via `handleAuthFailure`. Shared by the project selection and listing flows.
|
|
@@ -9,12 +9,22 @@ import type { MeticulousClient, OAuthDefaultProjectResponse, OAuthProject } from
|
|
|
9
9
|
* returns.
|
|
10
10
|
*/
|
|
11
11
|
export declare const fetchAccessibleProjects: (client: MeticulousClient) => Promise<OAuthProject[]>;
|
|
12
|
+
/**
|
|
13
|
+
* The `auth list-projects` operation itself, as opposed to the incidental
|
|
14
|
+
* listing {@link fetchAccessibleProjects} does for the interactive picker and
|
|
15
|
+
* its error messages. It goes through the agent endpoint so the two are
|
|
16
|
+
* distinguishable server-side — a counter that also fired for every picker
|
|
17
|
+
* render would not measure the command.
|
|
18
|
+
*/
|
|
19
|
+
export declare const listProjectsForUser: (client: MeticulousClient) => Promise<AgentProjectListItem[]>;
|
|
12
20
|
/** `"organization/name"` slug, falling back to the bare id if unnamed. */
|
|
13
21
|
export declare const formatProjectSlug: (project: Pick<OAuthDefaultProjectResponse, "projectId" | "name" | "organization">) => string;
|
|
14
22
|
/**
|
|
15
23
|
* Picks a project and persists it as the caller's default (via the backend —
|
|
16
|
-
* see `
|
|
17
|
-
* MCP server). Shared by `auth login` and `auth set-project
|
|
24
|
+
* see `setAgentCurrentProject`, consistent across machines and visible to the
|
|
25
|
+
* MCP server). Shared by `auth login` and `auth set-project`: choosing a
|
|
26
|
+
* default at login is the same operation as choosing one later, so both count
|
|
27
|
+
* as one server-side.
|
|
18
28
|
*
|
|
19
29
|
* - When `project` is given, it's resolved by the backend, which accepts any of
|
|
20
30
|
* a bare id, an `organization/name` slug, or a unique bare name (see
|
|
@@ -33,7 +43,13 @@ export declare const selectAndStoreProject: ({ client, project, allowInteractive
|
|
|
33
43
|
client: MeticulousClient;
|
|
34
44
|
project?: string | undefined;
|
|
35
45
|
allowInteractivePrompt?: boolean;
|
|
36
|
-
}) => Promise<
|
|
46
|
+
}) => Promise<SelectedProject>;
|
|
47
|
+
/** The stored default project, as `auth set-project --json` reports it. */
|
|
48
|
+
export interface SelectedProject {
|
|
49
|
+
/** `"organization/name"` slug. */
|
|
50
|
+
project: string;
|
|
51
|
+
projectId: string;
|
|
52
|
+
}
|
|
37
53
|
/**
|
|
38
54
|
* Project selection for `auth login`. Behaves like `selectAndStoreProject`
|
|
39
55
|
* (persist an explicit `--project`, auto-select+persist a sole project, prompt
|