@alwaysmeticulous/cli 2.300.0 → 2.303.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.
Files changed (111) hide show
  1. package/dist/command-utils/detect-upload-mode.d.ts +12 -0
  2. package/dist/command-utils/detect-upload-mode.d.ts.map +1 -0
  3. package/dist/command-utils/detect-upload-mode.js +27 -0
  4. package/dist/command-utils/detect-upload-mode.js.map +1 -0
  5. package/dist/command-utils/detect-upload-mode.spec.d.ts +2 -0
  6. package/dist/command-utils/detect-upload-mode.spec.d.ts.map +1 -0
  7. package/dist/command-utils/detect-upload-mode.spec.js +30 -0
  8. package/dist/command-utils/detect-upload-mode.spec.js.map +1 -0
  9. package/dist/command-utils/parse-container-env.d.ts +9 -0
  10. package/dist/command-utils/parse-container-env.d.ts.map +1 -0
  11. package/dist/command-utils/parse-container-env.js +23 -0
  12. package/dist/command-utils/parse-container-env.js.map +1 -0
  13. package/dist/command-utils/parse-rewrites.d.ts +2 -2
  14. package/dist/command-utils/parse-rewrites.d.ts.map +1 -1
  15. package/dist/command-utils/parse-rewrites.js +11 -16
  16. package/dist/command-utils/parse-rewrites.js.map +1 -1
  17. package/dist/command-utils/sentry.utils.js +3 -4
  18. package/dist/command-utils/sentry.utils.js.map +1 -1
  19. package/dist/commands/agent/build-git-options.d.ts +69 -0
  20. package/dist/commands/agent/build-git-options.d.ts.map +1 -0
  21. package/dist/commands/agent/build-git-options.js +148 -0
  22. package/dist/commands/agent/build-git-options.js.map +1 -0
  23. package/dist/commands/agent/build-git-options.spec.d.ts +2 -0
  24. package/dist/commands/agent/build-git-options.spec.d.ts.map +1 -0
  25. package/dist/commands/agent/build-git-options.spec.js +226 -0
  26. package/dist/commands/agent/build-git-options.spec.js.map +1 -0
  27. package/dist/commands/agent/index.d.ts.map +1 -1
  28. package/dist/commands/agent/index.js +12 -3
  29. package/dist/commands/agent/index.js.map +1 -1
  30. package/dist/commands/agent/js-coverage-diff.command.d.ts +2 -0
  31. package/dist/commands/agent/js-coverage-diff.command.d.ts.map +1 -1
  32. package/dist/commands/agent/js-coverage-diff.command.js +16 -4
  33. package/dist/commands/agent/js-coverage-diff.command.js.map +1 -1
  34. package/dist/commands/agent/js-coverage.command.d.ts +13 -1
  35. package/dist/commands/agent/js-coverage.command.d.ts.map +1 -1
  36. package/dist/commands/agent/js-coverage.command.js +187 -38
  37. package/dist/commands/agent/js-coverage.command.js.map +1 -1
  38. package/dist/commands/agent/js-coverage.command.spec.d.ts +2 -0
  39. package/dist/commands/agent/js-coverage.command.spec.d.ts.map +1 -0
  40. package/dist/commands/agent/js-coverage.command.spec.js +89 -0
  41. package/dist/commands/agent/js-coverage.command.spec.js.map +1 -0
  42. package/dist/commands/agent/test-run-diffs.command.d.ts +1 -2
  43. package/dist/commands/agent/test-run-diffs.command.d.ts.map +1 -1
  44. package/dist/commands/agent/test-run-diffs.command.js +27 -34
  45. package/dist/commands/agent/test-run-diffs.command.js.map +1 -1
  46. package/dist/commands/agent/test-run-for-commit.command.d.ts +1 -0
  47. package/dist/commands/agent/test-run-for-commit.command.d.ts.map +1 -1
  48. package/dist/commands/agent/test-run-for-commit.command.js +40 -15
  49. package/dist/commands/agent/test-run-for-commit.command.js.map +1 -1
  50. package/dist/commands/agent/trigger-test-run.command.d.ts +16 -0
  51. package/dist/commands/agent/trigger-test-run.command.d.ts.map +1 -0
  52. package/dist/commands/agent/trigger-test-run.command.js +219 -0
  53. package/dist/commands/agent/trigger-test-run.command.js.map +1 -0
  54. package/dist/commands/agent/upload-build.command.d.ts +19 -0
  55. package/dist/commands/agent/upload-build.command.d.ts.map +1 -0
  56. package/dist/commands/agent/upload-build.command.js +134 -0
  57. package/dist/commands/agent/upload-build.command.js.map +1 -0
  58. package/dist/commands/auth/__tests__/login.command.spec.js +39 -2
  59. package/dist/commands/auth/__tests__/login.command.spec.js.map +1 -1
  60. package/dist/commands/auth/login.command.d.ts +1 -0
  61. package/dist/commands/auth/login.command.d.ts.map +1 -1
  62. package/dist/commands/auth/login.command.js +40 -10
  63. package/dist/commands/auth/login.command.js.map +1 -1
  64. package/dist/commands/auth/set-project.command.d.ts.map +1 -1
  65. package/dist/commands/auth/set-project.command.js +10 -4
  66. package/dist/commands/auth/set-project.command.js.map +1 -1
  67. package/dist/commands/ci/deprecated-trigger-options.d.ts +19 -0
  68. package/dist/commands/ci/deprecated-trigger-options.d.ts.map +1 -0
  69. package/dist/commands/ci/deprecated-trigger-options.js +37 -0
  70. package/dist/commands/ci/deprecated-trigger-options.js.map +1 -0
  71. package/dist/commands/ci/resolve-git-options.d.ts +0 -1
  72. package/dist/commands/ci/resolve-git-options.d.ts.map +1 -1
  73. package/dist/commands/ci/resolve-git-options.js +3 -4
  74. package/dist/commands/ci/resolve-git-options.js.map +1 -1
  75. package/dist/commands/ci/run-with-uploaded-asset-chunks.command.d.ts.map +1 -1
  76. package/dist/commands/ci/run-with-uploaded-asset-chunks.command.js +3 -4
  77. package/dist/commands/ci/run-with-uploaded-asset-chunks.command.js.map +1 -1
  78. package/dist/commands/ci/trigger-test-run.core.d.ts +16 -0
  79. package/dist/commands/ci/trigger-test-run.core.d.ts.map +1 -0
  80. package/dist/commands/ci/trigger-test-run.core.js +194 -0
  81. package/dist/commands/ci/trigger-test-run.core.js.map +1 -0
  82. package/dist/commands/ci/trigger-test-run.types.d.ts +31 -0
  83. package/dist/commands/ci/trigger-test-run.types.d.ts.map +1 -0
  84. package/dist/commands/ci/trigger-test-run.types.js +6 -0
  85. package/dist/commands/ci/trigger-test-run.types.js.map +1 -0
  86. package/dist/commands/ci/upload-assets.command.d.ts +0 -1
  87. package/dist/commands/ci/upload-assets.command.d.ts.map +1 -1
  88. package/dist/commands/ci/upload-assets.command.js +16 -124
  89. package/dist/commands/ci/upload-assets.command.js.map +1 -1
  90. package/dist/commands/ci/upload-container.command.d.ts +0 -1
  91. package/dist/commands/ci/upload-container.command.d.ts.map +1 -1
  92. package/dist/commands/ci/upload-container.command.js +18 -131
  93. package/dist/commands/ci/upload-container.command.js.map +1 -1
  94. package/dist/main.d.ts.map +1 -1
  95. package/dist/main.js +5 -3
  96. package/dist/main.js.map +1 -1
  97. package/dist/utils/__tests__/select-project.spec.js +47 -2
  98. package/dist/utils/__tests__/select-project.spec.js.map +1 -1
  99. package/dist/utils/cli-user-error.d.ts +3 -1
  100. package/dist/utils/cli-user-error.d.ts.map +1 -1
  101. package/dist/utils/cli-user-error.js +5 -14
  102. package/dist/utils/cli-user-error.js.map +1 -1
  103. package/dist/utils/resolve-test-run-from-commit.d.ts +31 -5
  104. package/dist/utils/resolve-test-run-from-commit.d.ts.map +1 -1
  105. package/dist/utils/resolve-test-run-from-commit.js +59 -19
  106. package/dist/utils/resolve-test-run-from-commit.js.map +1 -1
  107. package/dist/utils/select-project.d.ts +9 -3
  108. package/dist/utils/select-project.d.ts.map +1 -1
  109. package/dist/utils/select-project.js +30 -7
  110. package/dist/utils/select-project.js.map +1 -1
  111. package/package.json +13 -13
@@ -0,0 +1,12 @@
1
+ export type UploadMode = "assets" | "container";
2
+ /**
3
+ * Auto-detects the upload mode from the provided inputs: a `localImageTag`
4
+ * selects container mode, `appDirectory`/`appZip` select asset mode. Throws a
5
+ * `CliUserError` when neither or both are provided.
6
+ */
7
+ export declare const detectUploadMode: ({ localImageTag, appDirectory, appZip, }: {
8
+ localImageTag?: string | undefined;
9
+ appDirectory?: string | undefined;
10
+ appZip?: string | undefined;
11
+ }) => UploadMode;
12
+ //# sourceMappingURL=detect-upload-mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-upload-mode.d.ts","sourceRoot":"","sources":["../../src/command-utils/detect-upload-mode.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,6CAI1B;IACD,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,KAAG,UAkBH,CAAC"}
@@ -0,0 +1,27 @@
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]="7af8d304-c7de-5861-847f-6b89d15ba605")}catch(e){}}();
3
+
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.detectUploadMode = void 0;
6
+ const cli_user_error_1 = require("../utils/cli-user-error");
7
+ /**
8
+ * Auto-detects the upload mode from the provided inputs: a `localImageTag`
9
+ * selects container mode, `appDirectory`/`appZip` select asset mode. Throws a
10
+ * `CliUserError` when neither or both are provided.
11
+ */
12
+ const detectUploadMode = ({ localImageTag, appDirectory, appZip, }) => {
13
+ const hasContainer = Boolean(localImageTag);
14
+ const hasAssets = Boolean(appDirectory || appZip);
15
+ if (hasContainer && hasAssets) {
16
+ throw new cli_user_error_1.CliUserError("Provide either container input (--localImageTag) or asset input " +
17
+ "(--appDirectory/--appZip), not both.");
18
+ }
19
+ if (!hasContainer && !hasAssets) {
20
+ throw new cli_user_error_1.CliUserError("No upload input provided. Pass --localImageTag for a container, or " +
21
+ "--appDirectory/--appZip for static assets.");
22
+ }
23
+ return hasContainer ? "container" : "assets";
24
+ };
25
+ exports.detectUploadMode = detectUploadMode;
26
+ //# sourceMappingURL=detect-upload-mode.js.map
27
+ //# debugId=7af8d304-c7de-5861-847f-6b89d15ba605
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-upload-mode.js","sources":["../../src/command-utils/detect-upload-mode.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAAA,4DAAuD;AAIvD;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAC/B,aAAa,EACb,YAAY,EACZ,MAAM,GAKP,EAAc,EAAE;IACf,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,IAAI,MAAM,CAAC,CAAC;IAElD,IAAI,YAAY,IAAI,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,6BAAY,CACpB,kEAAkE;YAChE,sCAAsC,CACzC,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,YAAY,IAAI,CAAC,SAAS,EAAE,CAAC;QAChC,MAAM,IAAI,6BAAY,CACpB,qEAAqE;YACnE,4CAA4C,CAC/C,CAAC;IACJ,CAAC;IAED,OAAO,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC/C,CAAC,CAAC;AA1BW,QAAA,gBAAgB,oBA0B3B","debugId":"7af8d304-c7de-5861-847f-6b89d15ba605"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=detect-upload-mode.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-upload-mode.spec.d.ts","sourceRoot":"","sources":["../../src/command-utils/detect-upload-mode.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
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]="c43831af-e023-5d78-b511-aaa1078c17b4")}catch(e){}}();
3
+
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ const vitest_1 = require("vitest");
6
+ const cli_user_error_1 = require("../utils/cli-user-error");
7
+ const detect_upload_mode_1 = require("./detect-upload-mode");
8
+ (0, vitest_1.describe)("detectUploadMode", () => {
9
+ (0, vitest_1.test)("returns 'container' when a local image tag is provided", () => {
10
+ (0, vitest_1.expect)((0, detect_upload_mode_1.detectUploadMode)({ localImageTag: "myapp:latest" })).toBe("container");
11
+ });
12
+ (0, vitest_1.test)("returns 'assets' when an app directory is provided", () => {
13
+ (0, vitest_1.expect)((0, detect_upload_mode_1.detectUploadMode)({ appDirectory: "./dist" })).toBe("assets");
14
+ });
15
+ (0, vitest_1.test)("returns 'assets' when an app zip is provided", () => {
16
+ (0, vitest_1.expect)((0, detect_upload_mode_1.detectUploadMode)({ appZip: "./app.zip" })).toBe("assets");
17
+ });
18
+ (0, vitest_1.test)("throws when neither container nor asset input is provided", () => {
19
+ (0, vitest_1.expect)(() => (0, detect_upload_mode_1.detectUploadMode)({})).toThrow(cli_user_error_1.CliUserError);
20
+ });
21
+ (0, vitest_1.test)("throws when both container and asset input are provided", () => {
22
+ (0, vitest_1.expect)(() => (0, detect_upload_mode_1.detectUploadMode)({
23
+ localImageTag: "myapp:latest",
24
+ appDirectory: "./dist",
25
+ })).toThrow(cli_user_error_1.CliUserError);
26
+ (0, vitest_1.expect)(() => (0, detect_upload_mode_1.detectUploadMode)({ localImageTag: "myapp:latest", appZip: "./app.zip" })).toThrow(cli_user_error_1.CliUserError);
27
+ });
28
+ });
29
+ //# sourceMappingURL=detect-upload-mode.spec.js.map
30
+ //# debugId=c43831af-e023-5d78-b511-aaa1078c17b4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-upload-mode.spec.js","sources":["../../src/command-utils/detect-upload-mode.spec.ts"],"sourceRoot":"","names":[],"mappings":";;;;AAAA,mCAAgD;AAChD,4DAAuD;AACvD,6DAAwD;AAExD,IAAA,iBAAQ,EAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAA,aAAI,EAAC,wDAAwD,EAAE,GAAG,EAAE;QAClE,IAAA,eAAM,EAAC,IAAA,qCAAgB,EAAC,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,IAAI,CAC9D,WAAW,CACZ,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,oDAAoD,EAAE,GAAG,EAAE;QAC9D,IAAA,eAAM,EAAC,IAAA,qCAAgB,EAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,8CAA8C,EAAE,GAAG,EAAE;QACxD,IAAA,eAAM,EAAC,IAAA,qCAAgB,EAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACrE,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,IAAA,qCAAgB,EAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,6BAAY,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,yDAAyD,EAAE,GAAG,EAAE;QACnE,IAAA,eAAM,EAAC,GAAG,EAAE,CACV,IAAA,qCAAgB,EAAC;YACf,aAAa,EAAE,cAAc;YAC7B,YAAY,EAAE,QAAQ;SACvB,CAAC,CACH,CAAC,OAAO,CAAC,6BAAY,CAAC,CAAC;QACxB,IAAA,eAAM,EAAC,GAAG,EAAE,CACV,IAAA,qCAAgB,EAAC,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CACzE,CAAC,OAAO,CAAC,6BAAY,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","debugId":"c43831af-e023-5d78-b511-aaa1078c17b4"}
@@ -0,0 +1,9 @@
1
+ import type { ContainerEnvVariable } from "@alwaysmeticulous/client";
2
+ /**
3
+ * Parses repeated `--containerEnv name=value` CLI flags into the structured
4
+ * array the API expects. Throws a `CliUserError` on malformed input (reported
5
+ * cleanly by the top-level `wrapHandler`). Shared by `agent upload-build` and
6
+ * the deprecated `ci upload-container`.
7
+ */
8
+ export declare const parseContainerEnv: (value: string[]) => ContainerEnvVariable[];
9
+ //# sourceMappingURL=parse-container-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-container-env.d.ts","sourceRoot":"","sources":["../../src/command-utils/parse-container-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGrE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,UAAW,MAAM,EAAE,KAAG,oBAAoB,EAUpE,CAAC"}
@@ -0,0 +1,23 @@
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]="89219249-ca36-5778-b050-5b05e2063026")}catch(e){}}();
3
+
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.parseContainerEnv = void 0;
6
+ const cli_user_error_1 = require("../utils/cli-user-error");
7
+ /**
8
+ * Parses repeated `--containerEnv name=value` CLI flags into the structured
9
+ * array the API expects. Throws a `CliUserError` on malformed input (reported
10
+ * cleanly by the top-level `wrapHandler`). Shared by `agent upload-build` and
11
+ * the deprecated `ci upload-container`.
12
+ */
13
+ const parseContainerEnv = (value) => value.map((v) => {
14
+ const [name, ...rest] = v.split("=");
15
+ const envValue = rest.join("=");
16
+ if (!name || !envValue) {
17
+ throw new cli_user_error_1.CliUserError(`Invalid environment variable: "${v}". Expected the form name=value.`);
18
+ }
19
+ return { name, value: envValue };
20
+ });
21
+ exports.parseContainerEnv = parseContainerEnv;
22
+ //# sourceMappingURL=parse-container-env.js.map
23
+ //# debugId=89219249-ca36-5778-b050-5b05e2063026
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-container-env.js","sources":["../../src/command-utils/parse-container-env.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AACA,4DAAuD;AAEvD;;;;;GAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAe,EAA0B,EAAE,CAC3E,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;IACd,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QACvB,MAAM,IAAI,6BAAY,CACpB,kCAAkC,CAAC,kCAAkC,CACtE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACnC,CAAC,CAAC,CAAC;AAVQ,QAAA,iBAAiB,qBAUzB","debugId":"89219249-ca36-5778-b050-5b05e2063026"}
@@ -1,8 +1,8 @@
1
1
  import type { AssetUploadMetadata } from "@alwaysmeticulous/api";
2
2
  /**
3
3
  * Parses the `--rewrites` CLI flag's JSON string into the structured array
4
- * `AssetUploadMetadata["rewrites"]` expects. Exits the process with a clear
5
- * error message on malformed input rather than throwing.
4
+ * `AssetUploadMetadata["rewrites"]` expects. Throws a `CliUserError` on
5
+ * malformed input (reported cleanly by the top-level `wrapHandler`).
6
6
  */
7
7
  export declare const parseRewrites: (rewritesString?: string) => AssetUploadMetadata["rewrites"];
8
8
  //# sourceMappingURL=parse-rewrites.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-rewrites.d.ts","sourceRoot":"","sources":["../../src/command-utils/parse-rewrites.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGjE;;;;GAIG;AACH,eAAO,MAAM,aAAa,oBACP,MAAM,KACtB,mBAAmB,CAAC,UAAU,CAyChC,CAAC"}
1
+ {"version":3,"file":"parse-rewrites.d.ts","sourceRoot":"","sources":["../../src/command-utils/parse-rewrites.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGjE;;;;GAIG;AACH,eAAO,MAAM,aAAa,oBACP,MAAM,KACtB,mBAAmB,CAAC,UAAU,CAkChC,CAAC"}
@@ -1,42 +1,37 @@
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]="349c57f9-6916-5c8c-accd-7f458cf02525")}catch(e){}}();
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]="4905220c-3b2e-51ec-9202-bd724dda1214")}catch(e){}}();
3
3
 
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.parseRewrites = void 0;
6
- const common_1 = require("@alwaysmeticulous/common");
6
+ const cli_user_error_1 = require("../utils/cli-user-error");
7
7
  /**
8
8
  * Parses the `--rewrites` CLI flag's JSON string into the structured array
9
- * `AssetUploadMetadata["rewrites"]` expects. Exits the process with a clear
10
- * error message on malformed input rather than throwing.
9
+ * `AssetUploadMetadata["rewrites"]` expects. Throws a `CliUserError` on
10
+ * malformed input (reported cleanly by the top-level `wrapHandler`).
11
11
  */
12
12
  const parseRewrites = (rewritesString) => {
13
- const logger = (0, common_1.initLogger)();
14
13
  let parsedRewrites;
15
14
  try {
16
15
  parsedRewrites = JSON.parse(rewritesString ?? "[]");
17
16
  }
18
17
  catch (error) {
19
- logger.error("Error: Could not parse --rewrites flag. Expected a valid JSON array string.");
20
- if (error instanceof Error) {
21
- logger.error(error.message);
22
- }
23
- process.exit(1);
18
+ throw new cli_user_error_1.CliUserError("Could not parse --rewrites flag. Expected a valid JSON array string." +
19
+ (error instanceof Error ? ` ${error.message}` : ""));
24
20
  }
25
21
  if (!Array.isArray(parsedRewrites)) {
26
- logger.error("Error: Invalid --rewrites flag. Expected a valid JSON array string.");
27
- process.exit(1);
22
+ throw new cli_user_error_1.CliUserError("Invalid --rewrites flag. Expected a valid JSON array string.");
28
23
  }
29
24
  const isValid = parsedRewrites.every((item) => typeof item === "object" &&
30
25
  item !== null &&
31
26
  typeof item.source === "string" &&
32
27
  typeof item.destination === "string");
33
28
  if (!isValid) {
34
- logger.error("Error: Invalid --rewrites flag. Each element in the array must be an object with 'source' and 'destination' string properties.");
35
- logger.error("See https://github.com/vercel/serve-handler?tab=readme-ov-file#rewrites-array for more details.");
36
- process.exit(1);
29
+ throw new cli_user_error_1.CliUserError("Invalid --rewrites flag. Each element in the array must be an object " +
30
+ "with 'source' and 'destination' string properties. See " +
31
+ "https://github.com/vercel/serve-handler?tab=readme-ov-file#rewrites-array for more details.");
37
32
  }
38
33
  return parsedRewrites;
39
34
  };
40
35
  exports.parseRewrites = parseRewrites;
41
36
  //# sourceMappingURL=parse-rewrites.js.map
42
- //# debugId=349c57f9-6916-5c8c-accd-7f458cf02525
37
+ //# debugId=4905220c-3b2e-51ec-9202-bd724dda1214
@@ -1 +1 @@
1
- {"version":3,"file":"parse-rewrites.js","sources":["../../src/command-utils/parse-rewrites.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AACA,qDAAsD;AAEtD;;;;GAIG;AACI,MAAM,aAAa,GAAG,CAC3B,cAAuB,EACU,EAAE;IACnC,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;IAC5B,IAAI,cAAuB,CAAC;IAC5B,IAAI,CAAC;QACH,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CACV,6EAA6E,CAC9E,CAAC;QACF,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,KAAK,CACV,qEAAqE,CACtE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAClC,CAAC,IAAI,EAAE,EAAE,CACP,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,CACvC,CAAC;IAEF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CACV,gIAAgI,CACjI,CAAC;QACF,MAAM,CAAC,KAAK,CACV,iGAAiG,CAClG,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,cAAiD,CAAC;AAC3D,CAAC,CAAC;AA3CW,QAAA,aAAa,iBA2CxB","debugId":"349c57f9-6916-5c8c-accd-7f458cf02525"}
1
+ {"version":3,"file":"parse-rewrites.js","sources":["../../src/command-utils/parse-rewrites.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AACA,4DAAuD;AAEvD;;;;GAIG;AACI,MAAM,aAAa,GAAG,CAC3B,cAAuB,EACU,EAAE;IACnC,IAAI,cAAuB,CAAC;IAC5B,IAAI,CAAC;QACH,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,6BAAY,CACpB,sEAAsE;YACpE,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACtD,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,6BAAY,CACpB,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAClC,CAAC,IAAI,EAAE,EAAE,CACP,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,CACvC,CAAC;IAEF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,6BAAY,CACpB,uEAAuE;YACrE,yDAAyD;YACzD,6FAA6F,CAChG,CAAC;IACJ,CAAC;IAED,OAAO,cAAiD,CAAC;AAC3D,CAAC,CAAC;AApCW,QAAA,aAAa,iBAoCxB","debugId":"4905220c-3b2e-51ec-9202-bd724dda1214"}
@@ -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]="aa00a45a-22cf-50b2-bc86-117e11744c4a")}catch(e){}}();
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]="c732b556-69dd-57d0-90e9-aaa7ea4b2ab7")}catch(e){}}();
3
3
 
4
4
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
5
  if (k2 === undefined) k2 = k;
@@ -75,11 +75,10 @@ const wrapHandler = function wrapHandler_(handler) {
75
75
  exports.wrapHandler = wrapHandler;
76
76
  const reportHandlerError = (error) => {
77
77
  const logger = (0, common_1.initLogger)();
78
- logger.info("");
79
78
  // User-facing errors: message already explains what to do, and the
80
79
  // failure is expected (no Sentry, no --help tip, no stack).
81
80
  if (error instanceof cli_user_error_1.CliUserError) {
82
- logger.error(error.message);
81
+ logger[error.severity](error.message);
83
82
  return error.exitCode;
84
83
  }
85
84
  if ((0, client_1.isFetchError)(error)) {
@@ -104,4 +103,4 @@ const reportHandlerError = (error) => {
104
103
  return 1;
105
104
  };
106
105
  //# sourceMappingURL=sentry.utils.js.map
107
- //# debugId=aa00a45a-22cf-50b2-bc86-117e11744c4a
106
+ //# debugId=c732b556-69dd-57d0-90e9-aaa7ea4b2ab7
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.utils.js","sources":["../../src/command-utils/sentry.utils.ts"],"sourceRoot":"","names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAwD;AACxD,qDAAsD;AACtD,qDAAgE;AAChE,qDAAuC;AACvC,4DAAuD;AAEhD,MAAM,UAAU,GAA+B,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAAE,OAAkC,CAAC,CAAC;AAC1E,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEK,MAAM,WAAW,GAAG,SAAS,YAAY,CAC9C,OAAmC;IAEnC,OAAO,KAAK,EAAE,IAAO,EAAE,EAAE;QACvB,MAAM,OAAO,CAAC,IAAI,CAAC;aAChB,IAAI,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;YAC3C,IAAI,WAAW,EAAE,CAAC;gBAChB,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;gBACnC,WAAW,CAAC,GAAG,EAAE,CAAC;YACpB,CAAC;YACD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IAAI,CAAC,KAAK;YACzB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAC3B,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;SAAM,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC5B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,CAAC,IAAI,CACT,uIAAuI,CACxI,CAAC;IACF,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,CAAC,CAAC;AACX,CAAC,CAAC","debugId":"aa00a45a-22cf-50b2-bc86-117e11744c4a"}
1
+ {"version":3,"file":"sentry.utils.js","sources":["../../src/command-utils/sentry.utils.ts"],"sourceRoot":"","names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAwD;AACxD,qDAAsD;AACtD,qDAAgE;AAChE,qDAAuC;AACvC,4DAAuD;AAEhD,MAAM,UAAU,GAA+B,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAAE,OAAkC,CAAC,CAAC;AAC1E,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEK,MAAM,WAAW,GAAG,SAAS,YAAY,CAC9C,OAAmC;IAEnC,OAAO,KAAK,EAAE,IAAO,EAAE,EAAE;QACvB,MAAM,OAAO,CAAC,IAAI,CAAC;aAChB,IAAI,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,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AY,EAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC5B,IACE,KAAK,CAAC,QAAQ,EAAE,IAAI;YACpB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK;YACzB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAC3B,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;SAAM,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC5B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,CAAC,IAAI,CACT,uIAAuI,CACxI,CAAC;IACF,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,CAAC,CAAC;AACX,CAAC,CAAC","debugId":"c732b556-69dd-57d0-90e9-aaa7ea4b2ab7"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Resolves the commit a build is of, for `agent upload-build`. The build's
3
+ * commit must identify a real commit so the deployment's `commitSha` (and the
4
+ * test run's `execution_sha`) faithfully describe what ran:
5
+ * - explicit `--commitSha` wins;
6
+ * - otherwise the HEAD of the git repo at `--repoDirectory`, defaulting to the
7
+ * local repo (the current directory) when neither flag is given;
8
+ * - a dirty working tree is captured as an ephemeral `git stash create` commit
9
+ * (a real, unreferenced commit; HEAD/branch untouched) with a stderr warning.
10
+ */
11
+ /** Where a build's commit SHA came from (used to label CLI output). */
12
+ export type BuildCommitShaSource = "provided" | "local" | "local-ephemeral";
13
+ export interface ResolvedBuildCommitSha {
14
+ commitSha: string;
15
+ /**
16
+ * - "provided": an explicit `--commitSha`;
17
+ * - "local": the HEAD of the local repo;
18
+ * - "local-ephemeral": a `git stash create` commit for a dirty working tree.
19
+ */
20
+ source: BuildCommitShaSource;
21
+ }
22
+ export declare const resolveBuildCommitSha: ({ commitSha, repoDirectory, }: {
23
+ commitSha: string | undefined;
24
+ repoDirectory: string | undefined;
25
+ }) => Promise<ResolvedBuildCommitSha>;
26
+ /**
27
+ * Resolves the commit to look up an already-uploaded deployment for, when
28
+ * `agent trigger-test-run` is given neither `--deploymentId` nor `--commitSha`.
29
+ * Unlike `resolveBuildCommitSha`, a dirty working tree is a hard failure rather
30
+ * than falling back to an ephemeral `git stash create` commit: no deployment
31
+ * could ever have been uploaded for an ephemeral, unreachable commit, so
32
+ * inferring one here would only ever fail the lookup.
33
+ */
34
+ export declare const resolveHeadCommitShaForLookup: ({ repoDirectory, }: {
35
+ repoDirectory: string | undefined;
36
+ }) => Promise<string>;
37
+ export interface ResolvedComparison {
38
+ baseSha: string | undefined;
39
+ gitDiffOutput: string | undefined;
40
+ /**
41
+ * The head commit the diff was computed against. Only known when inferred from
42
+ * `--repoDirectory`; undefined when the caller passed an opaque `--gitDiffOutput`.
43
+ * Used to warn if it diverges from the deployment the run actually executes.
44
+ */
45
+ head: string | undefined;
46
+ /**
47
+ * True when `head` is an ephemeral `git stash create` commit (dirty tree).
48
+ * Such SHAs differ between invocations for identical content, so the head
49
+ * drift check is meaningless and should be skipped.
50
+ */
51
+ headIsEphemeral: boolean;
52
+ }
53
+ /**
54
+ * Resolves the comparison inputs (base + git diff) for `agent trigger-test-run`.
55
+ * Either pass them explicitly (`--baseSha`, optionally `--gitDiffOutput`), pass
56
+ * `--repoDirectory`, or pass nothing at all — when no comparison inputs are
57
+ * given we infer from the local repo (the current directory), the same way
58
+ * `--repoDirectory .` would. Inference yields:
59
+ * - `baseSha` from the merge-base with the origin default branch;
60
+ * - `gitDiffOutput` as `git diff base..head`, where head is the repo HEAD (or a
61
+ * `git stash create` commit when the tree is dirty, so the diff is always
62
+ * between two real commits — no working-tree special case).
63
+ */
64
+ export declare const resolveComparisonOptions: ({ baseSha, gitDiffOutput, repoDirectory, }: {
65
+ baseSha: string | undefined;
66
+ gitDiffOutput: string | undefined;
67
+ repoDirectory: string | undefined;
68
+ }) => Promise<ResolvedComparison>;
69
+ //# sourceMappingURL=build-git-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-git-options.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/build-git-options.ts"],"names":[],"mappings":"AAoCA;;;;;;;;;GASG;AACH,uEAAuE;AACvE,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,OAAO,GAAG,iBAAiB,CAAC;AAE5E,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AAED,eAAO,MAAM,qBAAqB,kCAG/B;IACD,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC,KAAG,OAAO,CAAC,sBAAsB,CAoDjC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,uBAEvC;IACD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC,KAAG,OAAO,CAAC,MAAM,CAkBjB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC;;;;OAIG;IACH,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB;;;;OAIG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,+CAIlC;IACD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC,KAAG,OAAO,CAAC,kBAAkB,CA8D7B,CAAC"}
@@ -0,0 +1,148 @@
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]="36ab3613-d063-5434-9c8b-f7074604bd39")}catch(e){}}();
3
+
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.resolveComparisonOptions = exports.resolveHeadCommitShaForLookup = exports.resolveBuildCommitSha = void 0;
6
+ const common_1 = require("@alwaysmeticulous/common");
7
+ const cli_user_error_1 = require("../../utils/cli-user-error");
8
+ /**
9
+ * Untracked files can't be captured by `git stash create` or a `base..head`
10
+ * diff, so when we infer a build commit / diff from the working tree we refuse
11
+ * to proceed while any exist — otherwise the commit and diff would silently
12
+ * omit them. Staging them (`git add`) moves them into the index, where both the
13
+ * stash commit and the diff pick them up.
14
+ */
15
+ const assertNoUntrackedFiles = async (options) => {
16
+ const untracked = await (0, common_1.getUntrackedFiles)(options);
17
+ if (untracked.length === 0) {
18
+ return;
19
+ }
20
+ const shown = untracked.slice(0, 10).join(", ");
21
+ const more = untracked.length > 10 ? `, … (+${untracked.length - 10} more)` : "";
22
+ throw new cli_user_error_1.CliUserError(`Untracked files present (${shown}${more}). ` +
23
+ "`git add` them (or add them to .gitignore) so they're captured in the " +
24
+ "build's commit and diff, then retry — or pass an explicit --commitSha.");
25
+ };
26
+ const resolveBuildCommitSha = async ({ commitSha, repoDirectory, }) => {
27
+ if (commitSha && repoDirectory) {
28
+ throw new cli_user_error_1.CliUserError("--commitSha and --repoDirectory are mutually exclusive. Pass --commitSha " +
29
+ "to use an explicit commit, or --repoDirectory to infer it from a git repository.");
30
+ }
31
+ if (commitSha) {
32
+ (0, common_1.logProgress)(`commitSha: ${commitSha}`);
33
+ return { commitSha, source: "provided" };
34
+ }
35
+ // No --repoDirectory means "use the local repo" (the current directory).
36
+ const gitOpts = { cwd: repoDirectory ?? "." };
37
+ (0, common_1.logProgress)(repoDirectory
38
+ ? `Using repo directory: ${repoDirectory}`
39
+ : "Using local repo directory");
40
+ await assertNoUntrackedFiles(gitOpts);
41
+ if (await (0, common_1.hasUncommittedChanges)(gitOpts)) {
42
+ const stashSha = await (0, common_1.getStashCreateSha)(gitOpts);
43
+ if (stashSha) {
44
+ // Always surface this (not just under --verbose): the build is registered
45
+ // against an ephemeral, unreachable stash commit, which the user can't
46
+ // otherwise recover.
47
+ (0, common_1.logNotice)(`commitSha (local, ephemeral due to dirty working tree): ${stashSha}`);
48
+ return { commitSha: stashSha, source: "local-ephemeral" };
49
+ }
50
+ // The tree is dirty but `git stash create` produced no commit, so we can't
51
+ // capture the uncommitted changes. Fail rather than silently registering the
52
+ // build against clean HEAD (which would omit them) — matches
53
+ // resolveComparisonOptions, which also treats this as fatal.
54
+ throw new cli_user_error_1.CliUserError("Working tree has uncommitted changes but they could not be captured (`git stash create` returned nothing). " +
55
+ "Commit or stash your changes, or pass an explicit --commitSha.");
56
+ }
57
+ const head = await (0, common_1.getCommitSha)(undefined, gitOpts);
58
+ if (!head) {
59
+ throw new cli_user_error_1.CliUserError("Could not determine a commit SHA. Pass --commitSha or run inside a git repository.");
60
+ }
61
+ (0, common_1.logProgress)(`commitSha (local): ${head}`);
62
+ return { commitSha: head, source: "local" };
63
+ };
64
+ exports.resolveBuildCommitSha = resolveBuildCommitSha;
65
+ /**
66
+ * Resolves the commit to look up an already-uploaded deployment for, when
67
+ * `agent trigger-test-run` is given neither `--deploymentId` nor `--commitSha`.
68
+ * Unlike `resolveBuildCommitSha`, a dirty working tree is a hard failure rather
69
+ * than falling back to an ephemeral `git stash create` commit: no deployment
70
+ * could ever have been uploaded for an ephemeral, unreachable commit, so
71
+ * inferring one here would only ever fail the lookup.
72
+ */
73
+ const resolveHeadCommitShaForLookup = async ({ repoDirectory, }) => {
74
+ const gitOpts = { cwd: repoDirectory ?? "." };
75
+ if (await (0, common_1.hasUncommittedChanges)(gitOpts)) {
76
+ throw new cli_user_error_1.CliUserError("Working tree has uncommitted changes, so the current commit can't be used to look up an already-uploaded deployment. " +
77
+ "Commit your changes, or pass an explicit --commitSha or --deploymentId.");
78
+ }
79
+ const head = await (0, common_1.getCommitSha)(undefined, gitOpts);
80
+ if (!head) {
81
+ throw new cli_user_error_1.CliUserError("Could not determine a commit SHA from the local repository. Pass --commitSha or --deploymentId, or run inside a git repository.");
82
+ }
83
+ (0, common_1.logProgress)(`commitSha (inferred from local HEAD): ${head}`);
84
+ return head;
85
+ };
86
+ exports.resolveHeadCommitShaForLookup = resolveHeadCommitShaForLookup;
87
+ /**
88
+ * Resolves the comparison inputs (base + git diff) for `agent trigger-test-run`.
89
+ * Either pass them explicitly (`--baseSha`, optionally `--gitDiffOutput`), pass
90
+ * `--repoDirectory`, or pass nothing at all — when no comparison inputs are
91
+ * given we infer from the local repo (the current directory), the same way
92
+ * `--repoDirectory .` would. Inference yields:
93
+ * - `baseSha` from the merge-base with the origin default branch;
94
+ * - `gitDiffOutput` as `git diff base..head`, where head is the repo HEAD (or a
95
+ * `git stash create` commit when the tree is dirty, so the diff is always
96
+ * between two real commits — no working-tree special case).
97
+ */
98
+ const resolveComparisonOptions = async ({ baseSha, gitDiffOutput, repoDirectory, }) => {
99
+ if (repoDirectory && (baseSha || gitDiffOutput)) {
100
+ throw new cli_user_error_1.CliUserError("--repoDirectory cannot be combined with --baseSha or --gitDiffOutput. " +
101
+ "When --repoDirectory is provided, both are inferred automatically.");
102
+ }
103
+ if (gitDiffOutput && !baseSha) {
104
+ throw new cli_user_error_1.CliUserError("--gitDiffOutput requires --baseSha.");
105
+ }
106
+ // With no explicit comparison inputs, fall back to inferring from the local
107
+ // repo (the current directory).
108
+ const effectiveRepoDirectory = repoDirectory ?? (!baseSha && !gitDiffOutput ? "." : undefined);
109
+ if (!effectiveRepoDirectory) {
110
+ return {
111
+ baseSha: baseSha || undefined,
112
+ gitDiffOutput: gitDiffOutput || undefined,
113
+ head: undefined,
114
+ headIsEphemeral: false,
115
+ };
116
+ }
117
+ const gitOpts = { cwd: effectiveRepoDirectory };
118
+ await assertNoUntrackedFiles(gitOpts);
119
+ const resolvedBase = (await (0, common_1.getLocalBaseSha)(gitOpts)) || undefined;
120
+ if (!resolvedBase) {
121
+ throw new cli_user_error_1.CliUserError(`Could not determine a base SHA from the git repository at '${effectiveRepoDirectory}'. ` +
122
+ "Ensure it has an 'origin/main' or 'origin/master' remote branch, or pass --baseSha explicitly.");
123
+ }
124
+ const dirty = await (0, common_1.hasUncommittedChanges)(gitOpts);
125
+ const head = dirty
126
+ ? await (0, common_1.getStashCreateSha)(gitOpts)
127
+ : await (0, common_1.getCommitSha)(undefined, gitOpts);
128
+ if (!head) {
129
+ throw new cli_user_error_1.CliUserError(`Could not determine head commit from the git repository at '${effectiveRepoDirectory}'.`);
130
+ }
131
+ if (dirty) {
132
+ // Always surface this (not just under --verbose): the diff is computed
133
+ // against an ephemeral stash commit rather than HEAD.
134
+ (0, common_1.logNotice)(`commitSha (local, ephemeral due to dirty working tree): ${head}`);
135
+ }
136
+ const diff = await (0, common_1.getGitDiff)(resolvedBase, head, gitOpts);
137
+ (0, common_1.logProgress)(`Base SHA inferred from merge-base: ${resolvedBase}`);
138
+ (0, common_1.logProgress)(`Git diff computed: ${diff.length} chars`);
139
+ return {
140
+ baseSha: resolvedBase,
141
+ gitDiffOutput: diff,
142
+ head,
143
+ headIsEphemeral: dirty,
144
+ };
145
+ };
146
+ exports.resolveComparisonOptions = resolveComparisonOptions;
147
+ //# sourceMappingURL=build-git-options.js.map
148
+ //# debugId=36ab3613-d063-5434-9c8b-f7074604bd39
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-git-options.js","sources":["../../../src/commands/agent/build-git-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AM,IAAI,6BAAY,CACpB,8DAA8D,sBAAsB,KAAK;YACvF,gGAAgG,CACnG,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,IAAA,8BAAqB,EAAC,OAAO,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,KAAK;QAChB,CAAC,CAAC,MAAM,IAAA,0BAAiB,EAAC,OAAO,CAAC;QAClC,CAAC,CAAC,MAAM,IAAA,qBAAY,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,6BAAY,CACpB,+DAA+D,sBAAsB,IAAI,CAC1F,CAAC;IACJ,CAAC;IACD,IAAI,KAAK,EAAE,CAAC;QACV,uEAAuE;QACvE,sDAAsD;QACtD,IAAA,kBAAS,EACP,2DAA2D,IAAI,EAAE,CAClE,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,IAAA,mBAAU,EAAC,YAAY,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,IAAA,oBAAW,EAAC,sCAAsC,YAAY,EAAE,CAAC,CAAC;IAClE,IAAA,oBAAW,EAAC,sBAAsB,IAAI,CAAC,MAAM,QAAQ,CAAC,CAAC;IAEvD,OAAO;QACL,OAAO,EAAE,YAAY;QACrB,aAAa,EAAE,IAAI;QACnB,IAAI;QACJ,eAAe,EAAE,KAAK;KACvB,CAAC;AACJ,CAAC,CAAC;AAtEW,QAAA,wBAAwB,4BAsEnC","debugId":"36ab3613-d063-5434-9c8b-f7074604bd39"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=build-git-options.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-git-options.spec.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/build-git-options.spec.ts"],"names":[],"mappings":""}