Skip to content

Commit 1705453

Browse files
authored
Refactor error messages in command runner and interactive runner to r… (#98)
* Update Jenkinsfile to allow publishing when building a tag in addition to the existing publish parameter. * 2.7.6-alpha.4 * Refactor error messages in command runner and interactive runner to remove user-specific context, ensuring consistency in error reporting. Update unit tests to reflect changes in error handling. * 2.7.6-alpha.5 * Enhance CLI documentation for `--no-wait` parameter compatibility with monitoring modes and improve path handling by ensuring tilde expansion only occurs at the start of paths. Update related functions to utilize the new path expansion logic and adjust unit tests for error message consistency. * Refactor import statements in command-runner-utilities.ts to use ES6 module syntax for consistency across the codebase. * Enhance unit tests for file path utilities by improving tilde expansion logic and error handling. Update mocks to use `vi.spyOn` for better control and consistency. Adjust assertions to reflect new behavior in path resolution and error messages. * 2.7.6-alpha.6 * Enhance parameter validation in command runner to ensure compatibility between `--no-wait`, `--monitor`, and download options. Update documentation to reflect these changes and clarify error handling for incompatible parameter combinations. Add unit tests to verify correct behavior when conflicting flags are used. * Improve validation for `--monitor` parameter in command runner to handle invalid values and missing arguments. Update unit tests to ensure proper error handling for these scenarios. * Update documentation for `--monitor` parameter to clarify valid values and error handling. Modify E2E tests to check for specific error messages related to invalid Personal Access Key format and monitor mode. Adjust unit tests to reflect optional parameter syntax for better validation. * 2.7.6-alpha.7 * Update E2E tests to require at least 1 successful operation for concurrent commands, reflecting expected behavior under config file access conflicts or timing issues. * 2.7.6 * #BE-7645 Fix Release Note Update for Uploading AAB File (#99) * Fix release not update for uploading aab (testing-distribution). * Add unit tests for appPath validation in file upload utilities. * 2.7.7-alpha.1 * Enhance error handling in upload functions to provide clearer messages for file size, API response format, and file extension errors. Improve spinner management during error reporting for better user experience. * 2.7.7-alpha.2 * Update documentation and interactive input handling for release notes. Clarify that two blank lines are required to finish entering release notes instead of pressing Enter twice. * 2.7.7 * Refactor version ID retrieval and release candidate marking in command runner. * Add unit tests for handleReleaseCandidateMarking to validate appVersionId and versionId retrieval from commitFileResponse, and ensure proper error handling when no app versions are found. * 2.7.8-alpha.1 * Add getAppVersionAfterUploadWithTaskCompletion function to improve app version retrieval after uploads, including task completion handling and filtering by upload time. Enhance unit tests to validate new functionality and ensure accurate version selection based on file size and name. * 2.7.8-alpha.2 * Enhance upload functions to support custom tags and release notes. * Remove deprecated release notes update logic from handleDistributionUpload and clean up related tests. Update unit tests to reflect changes in upload functionality. * 2.7.8-alpha.3 * Refactor Jenkins PAT (#100) * Fix release not update for uploading aab (testing-distribution). * Add unit tests for appPath validation in file upload utilities. * 2.7.7-alpha.1 * Enhance error handling in upload functions to provide clearer messages for file size, API response format, and file extension errors. Improve spinner management during error reporting for better user experience. * 2.7.7-alpha.2 * Update documentation and interactive input handling for release notes. Clarify that two blank lines are required to finish entering release notes instead of pressing Enter twice. * 2.7.7 * Refactor version ID retrieval and release candidate marking in command runner. * Add unit tests for handleReleaseCandidateMarking to validate appVersionId and versionId retrieval from commitFileResponse, and ensure proper error handling when no app versions are found. * 2.7.8-alpha.1 * Add getAppVersionAfterUploadWithTaskCompletion function to improve app version retrieval after uploads, including task completion handling and filtering by upload time. Enhance unit tests to validate new functionality and ensure accurate version selection based on file size and name. * 2.7.8-alpha.2 * Enhance upload functions to support custom tags and release notes. * Remove deprecated release notes update logic from handleDistributionUpload and clean up related tests. Update unit tests to reflect changes in upload functionality. * 2.7.8-alpha.3 * Update GitHub PAT credential in Jenkinsfile.
1 parent effb4a8 commit 1705453

28 files changed

Lines changed: 1762 additions & 341 deletions

Jenkinsfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pipeline {
55
}
66
environment {
77
NPM_AUTH_TOKEN = credentials('Appcircle-CLI-NPM-Cred')
8-
GITHUB_PAT = credentials('ozer-github-pat')
8+
GITHUB_PAT = credentials('appcircle-cli-gh-repo-fg-pat')
99
}
1010
stages {
1111
stage('PR Validation') {
@@ -230,7 +230,10 @@ pipeline {
230230

231231
stage('Publish') {
232232
when {
233-
expression { params.PUBLISH == true }
233+
anyOf {
234+
expression { params.PUBLISH == true }
235+
buildingTag()
236+
}
234237
}
235238
steps {
236239
sh '''#!/bin/bash

docs/build/start.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ appcircle build start [options]
2929
--configurationId <uuid> Configuration ID
3030
--configuration <string> Configuration name (alternative to --configurationId)
3131
--no-wait Don't wait for build completion, return immediately with task info
32+
Note: Incompatible with monitoring modes (--monitor) and download options
3233
--download-logs Automatically download build logs after completion
34+
Note: Cannot be used with --no-wait or --monitor none
3335
--download-artifacts Automatically download build artifacts after completion
36+
Note: Cannot be used with --no-wait or --monitor none
3437
--path <string> Download path for logs and artifacts (default: ~/Downloads)
35-
--monitor <mode> Build monitoring preference: none, summary (default), steps, or verbose
38+
--monitor [mode] Build monitoring preference: none, summary (default), steps, or verbose
39+
Valid values: none | summary | steps | verbose
40+
Note: Incompatible with --no-wait. Must be specified with a valid value.
3641
```
3742

3843
## Options inherited from parent commands
@@ -201,9 +206,11 @@ appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid> -
201206

202207
- **No Wait**: The `--no-wait` parameter is useful for automation scenarios where you don't want to wait for build completion. The command returns immediately with task information.
203208

204-
- **Auto Download**: The `--download-logs` and `--download-artifacts` parameters automatically download files after build completion. Use `--path` to specify a custom download location.
209+
- **Parameter Compatibility**: The `--no-wait` flag is incompatible with monitoring modes (`--monitor verbose`, `--monitor steps`, `--monitor summary`). If both are specified, the CLI will display an error and exit. For automation scenarios, use `--no-wait` without any monitoring flags (which defaults to immediate exit like `--monitor none`).
205210

206-
- **Monitoring Preferences**: The `--monitor` parameter allows you to control how build progress is displayed. The default `summary` mode provides real-time build status and duration, while `verbose` mode offers full verbose log streaming, `steps` shows step-by-step progress, and `none` returns only the task ID.
211+
- **Auto Download**: The `--download-logs` and `--download-artifacts` parameters automatically download files after build completion. Use `--path` to specify a custom download location. **Important**: These download options cannot be used with `--no-wait` or `--monitor none` because downloads require waiting for the build to complete. If you try to use them together, the CLI will display an error message with suggestions on how to resolve the conflict.
212+
213+
- **Monitoring Preferences**: The `--monitor` parameter allows you to control how build progress is displayed. The default `summary` mode provides real-time build status and duration, while `verbose` mode offers full verbose log streaming, `steps` shows step-by-step progress, and `none` returns only the task ID. **Important**: The `--monitor` flag must be provided with a valid value (`none`, `summary`, `steps`, or `verbose`). Using `--monitor` without a value or with an invalid value will result in an error.
207214

208215
- **Real-time Logs**: All monitor modes (except `none`) provide real-time log streaming, allowing you to monitor build progress as it happens. The system automatically formats logs and handles step transitions for better readability.
209216

docs/testing-distribution/upload.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ appcircle testing-distribution upload [options]
2020
--help Show help for command
2121
```
2222

23+
## Release Notes
24+
25+
- The `--message` parameter allows you to add release notes for your distribution
26+
- Release notes are supported for both APK and AAB files
27+
- In interactive mode, you can enter multi-line release notes:
28+
- Type your release notes line by line
29+
- Leave two blank lines to finish entering release notes
30+
- You can include line breaks and formatting in your release notes
31+
2332
## Note on File Size Limits
2433

2534
- The maximum allowed file size for uploads is 3 GB

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@appcircle/cli",
3-
"version": "2.7.6-alpha.3",
3+
"version": "2.7.8-alpha.3",
44
"description": "CLI tool for running Appcircle services from the command line",
55
"main": "bin/appcircle.js",
66
"bin": {

src/core/command-runner-utilities.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,25 @@ export const validateParameterErrorFlag = (params: any): ValidationResult => {
5858

5959
/**
6060
* Expands tilde (~) in file paths to home directory
61+
* Only expands ~ at the beginning of the path (e.g., ~/Desktop or ~\Desktop)
6162
* @param filePath Path that may contain tilde
6263
* @returns Expanded path
6364
*/
6465
export const expandTildeInPath = (filePath: string): string => {
6566
if (!filePath) return filePath;
6667

68+
const trimmedPath = filePath.trim();
6769
const homeDir = os.homedir();
68-
if (filePath.includes('~')) {
69-
return filePath.replace(/~/g, homeDir);
70+
71+
// Only expand tilde if it's at the start of the path
72+
if (trimmedPath === '~') {
73+
return homeDir;
74+
}
75+
if (trimmedPath.startsWith('~/') || trimmedPath.startsWith('~\\')) {
76+
return path.join(homeDir, trimmedPath.slice(2));
7077
}
71-
return filePath;
78+
79+
return trimmedPath;
7280
};
7381

7482
/**

0 commit comments

Comments
 (0)