From bf07d2738c307950eafa716430cdd4f67bebda30 Mon Sep 17 00:00:00 2001 From: litiantain Date: Fri, 17 Oct 2025 13:58:30 +0800 Subject: [PATCH 1/4] ci: configure GitHub Actions for Pages deployment and permission updates --- .github/workflows/homebrew.yml | 47 ++++ docs/USER_GUIDE.md | 398 ------------------------------ scripts/README.md | 409 +++++++++++++++++++++++++++---- scripts/generate-server-files.sh | 88 ------- scripts/index.html | 172 +++++++++++++ scripts/test.sh | 141 ----------- scripts/upload-to-oss.sh | 131 ---------- scripts/windows | 263 ++++++++++++++++++++ 8 files changed, 848 insertions(+), 801 deletions(-) delete mode 100644 docs/USER_GUIDE.md delete mode 100755 scripts/generate-server-files.sh create mode 100644 scripts/index.html delete mode 100755 scripts/test.sh delete mode 100644 scripts/upload-to-oss.sh create mode 100644 scripts/windows diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.yml index 04474c3..86b31dc 100644 --- a/.github/workflows/homebrew.yml +++ b/.github/workflows/homebrew.yml @@ -19,6 +19,8 @@ permissions: contents: write packages: write actions: read + pages: write + id-token: write # Global environment variables env: @@ -535,6 +537,51 @@ jobs: echo "" echo "๐Ÿ”— Homebrew Guidelines: https://docs.brew.sh/Adding-Software-to-Homebrew" + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Prepare deployment files + run: | + echo "๐Ÿ“ Preparing GitHub Pages deployment from scripts directory..." + + # ็กฎไฟscripts็›ฎๅฝ•ๅญ˜ๅœจ + if [ ! -d "scripts" ]; then + echo "โŒ scripts directory not found!" + exit 1 + fi + + # ๆ˜พ็คบๅฐ†่ฆ้ƒจ็ฝฒ็š„ๆ–‡ไปถ + echo "Files to be deployed:" + ls -la scripts/ + + # ้ชŒ่ฏๅ…ณ้”ฎๆ–‡ไปถๅญ˜ๅœจ + if [ ! -f "scripts/windows" ]; then + echo "โŒ scripts/windows file not found!" + exit 1 + fi + + if [ ! -f "scripts/index.html" ]; then + echo "โŒ scripts/index.html file not found!" + exit 1 + fi + + echo "โœ… All required files found" + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./scripts + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + + - name: Deployment summary + run: | + echo "๐ŸŽ‰ GitHub Pages deployment completed!" + echo "๐Ÿ“„ Site URL: ${{ steps.deployment.outputs.page_url }}" + echo "๐Ÿ”— Install command: powershell -Command \"irm https://litiantian123-code.github.io/agbcloud-cli/windows | iex\"" + - name: Validate Official Formula run: | echo "๐Ÿงช Validating Official Homebrew Formula (Source Build Mode)..." diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.md deleted file mode 100644 index 1228378..0000000 --- a/docs/USER_GUIDE.md +++ /dev/null @@ -1,398 +0,0 @@ -# AgbCloud CLI User Guide - -This guide will walk you through how to use the AgbCloud CLI tool for image management operations. - -## Table of Contents - -- [Prerequisites](#prerequisites) -- [1. Login Authentication](#1-login-authentication) -- [2. Create Image](#2-create-image) -- [3. Activate Image](#3-activate-image) -- [4. Deactivate Image](#4-deactivate-image) -- [5. List Images](#5-list-images) -- [FAQ](#faq) - -## Prerequisites - -Before getting started, please ensure: -- AgbCloud CLI tool is installed -- You have a valid AgbCloud account -- Network connection is available - -## 1. Login Authentication - -Before using any image management features, you need to log in to AgbCloud. - -### Command Syntax - -```bash -agb login -``` - -### Usage Steps - -1. **Execute login command**: - ```bash - agb login - ``` - -2. **System response**: - ``` - [SEC] Starting AgbCloud authentication... - [SIGNAL] Using callback port: 8080 - [WEB] Requesting OAuth login URL... - [OK] Successfully retrieved OAuth URL! - [DOC] Request ID: req-xxxxx - [SEARCH] Trace ID: trace-xxxxx - - [>>] Starting local callback server on port 8080... - [LINK] OAuth URL: - https://agb.cloud/oauth/authorize?... - - [WEB] Opening the browser for authentication... - ``` - -3. **Browser authentication**: - - CLI will automatically open the browser - - If the browser doesn't open automatically, manually copy the URL to your browser - - Complete Google account authentication in the browser - -4. **Authentication successful**: - ``` - [OK] Authentication successful! - [KEY] Received authorization code: abcd1234... - [REFRESH] Exchanging authorization code for access token... - [OK] Login successful! - ``` - -### Notes - -- Login session has a certain validity period, re-login is required after expiration -- Login information is securely stored in local configuration files - -## 2. Create Image - -Creating custom images requires providing a Dockerfile and base image ID. - -### Command Syntax - -```bash -agb image create --dockerfile --imageId -``` - -### Parameter Description - -- ``: Custom image name (required) -- `--dockerfile, -f`: Dockerfile file path (required) -- `--imageId, -i`: Base image ID (required) - -### Usage Examples - -```bash -# Full command -agb image create myCustomImage --dockerfile ./Dockerfile --imageId agb-code-space-1 - -# Using short parameters -agb image create myCustomImage -f ./Dockerfile -i agb-code-space-1 -``` - -### Execution Flow - -1. **Start creation**: - ``` - [BUILD] Creating image 'myCustomImage'... - [SIGNAL] Getting upload credentials... - [OK] Upload credentials obtained (Task ID: task-xxxxx) - ``` - -2. **Upload Dockerfile**: - ``` - [UPLOAD] Uploading Dockerfile... - [OK] Dockerfile uploaded successfully - ``` - -3. **Create image**: - ``` - [WORK] Creating image... - [OK] Image creation initiated - ``` - -4. **Monitor progress**: - ``` - [MONITOR] Monitoring image creation progress... - [DATA] Status: Creating - [DATA] Status: Available - [OK] Image creation completed successfully! - ``` - -### Image Status Description - -- **Creating**: Image is being created -- **Create Failed**: Image creation failed -- **Available**: Image creation completed and ready to use - -## 3. Activate Image - -Activating an image starts a running instance. You can specify CPU and memory resources. - -### Command Syntax - -```bash -agb image activate [--cpu ] [--memory ] -``` - -### Parameter Description - -- ``: Image ID to activate (required) -- `--cpu, -c`: CPU cores (optional, must be used together with memory parameter) -- `--memory, -m`: Memory size in GB (optional, must be used together with CPU parameter) - -**Supported CPU/Memory combinations:** -- `2c4g`: 2 CPU cores + 4 GB memory -- `4c8g`: 4 CPU cores + 8 GB memory -- `8c16g`: 8 CPU cores + 16 GB memory - -**Note:** If CPU and memory parameters are not specified, default resource configuration will be used. If specified, both CPU and memory must be provided and must be one of the supported combinations above. - -### Usage Examples - -```bash -# Basic activation (using default resources) -agb image activate img-7a8b9c1d0e - -# Using 2c4g configuration -agb image activate img-7a8b9c1d0e --cpu 2 --memory 4 - -# Using 4c8g configuration -agb image activate img-7a8b9c1d0e --cpu 4 --memory 8 - -# Using 8c16g configuration -agb image activate img-7a8b9c1d0e --cpu 8 --memory 16 - -# Using short parameters -agb image activate img-7a8b9c1d0e -c 4 -m 8 -``` - -### Execution Flow - -1. **Start activation**: - ``` - [>>] Activating image 'img-7a8b9c1d0e'... - [SAVE] CPU: 4 cores, Memory: 8 GB - [SEARCH] Checking current image status... - ``` - -2. **Status check**: - ``` - [DATA] Current Status: Available - [OK] Image is available, proceeding with activation... - [REFRESH] Starting image activation... - ``` - -3. **Activation successful**: - ``` - [OK] Image activation initiated successfully! - [DATA] Operation Status: true - [SEARCH] Request ID: req-xxxxx - ``` - -4. **Monitor activation status**: - ``` - [MONITOR] Monitoring image activation status... - [DATA] Status: Activating - [DATA] Status: Activated - [OK] Image activation completed successfully! - ``` - -### Image Activation Status Description - -- **Available**: Image is available but not activated -- **Activating**: Image is being activated -- **Activated**: Image is activated and running -- **Activate Failed**: Image activation failed -- **Ceased Billing**: Image has stopped billing - -### Special Case Handling - -- If the image is already activated, the system will display the current status -- If the image is being activated, it will automatically join the monitoring process -- If the image is in a failed state, it will attempt to reactivate -- **If an invalid CPU/memory combination is specified, the system will show an error and display supported combinations** - -### Error Examples - -```bash -# Invalid combination example -agb image activate img-7a8b9c1d0e --cpu 3 --memory 6 - -# Error output -[ERROR] Invalid CPU/Memory combination: 3c6g - -[TOOL] Supported combinations: - โ€ข 2c4g: --cpu 2 --memory 4 - โ€ข 4c8g: --cpu 4 --memory 8 - โ€ข 8c16g: --cpu 8 --memory 16 -``` - -## 4. Deactivate Image - -Deactivate (stop) a running image instance. - -### Command Syntax - -```bash -agb image deactivate -``` - -### Parameter Description - -- ``: Image ID to deactivate (required) - -### Usage Examples - -```bash -agb image deactivate img-7a8b9c1d0e -``` - -### Execution Flow - -1. **Start deactivation**: - ``` - ๐Ÿ›‘ Deactivating image 'img-7a8b9c1d0e'... - [REFRESH] Deactivating image instance... - ``` - -2. **Deactivation successful**: - ``` - [OK] Image deactivation initiated successfully! - [DATA] Operation Status: true - [SEARCH] Request ID: req-xxxxx - ``` - -### Notes - -- Deactivating an image will terminate the running instance -- The image status will change to "Available" after deactivation -- Deactivation operation usually takes effect immediately - -## 5. List Images - -View your image list with pagination and type filtering support. - -### Command Syntax - -```bash -agb image list [--type ] [--page ] [--size ] -``` - -### Parameter Description - -- `--type, -t`: Image type, options: - - `User`: User custom images (default) - - `System`: System-provided base images -- `--page, -p`: Page number, default is 1 -- `--size, -s`: Items per page, default is 10 - -### Usage Examples - -```bash -# View user images (default) -agb image list - -# View system images -agb image list --type System - -# Paginated view -agb image list --page 2 --size 5 - -# Using short parameters -agb image list -t User -p 1 -s 20 -``` - -### Output Example - -``` -[DOC] Listing User images (Page 1, Size 10)... -[SEARCH] Fetching image list... -[OK] Found 3 images (Total: 3) -[PAGE] Page 1 of 1 (Page Size: 10) - -IMAGE ID IMAGE NAME STATUS TYPE UPDATED AT --------- ---------- ------ ---- ---------- -img-7a8b9c1d0e myCustomImage Available User 2025-01-15 10:30 -img-2f3g4h5i6j webAppImage Activated User 2025-01-15 09:15 -img-8k9l0m1n2o dataProcessImage Creating User 2025-01-15 11:45 -``` - -### Status Description - -Images can be in the following states: - -**Creation-related statuses:** -- **Creating**: Image is being created -- **Create Failed**: Image creation failed -- **Available**: Image creation completed and ready to use - -**Activation-related statuses:** -- **Activating**: Image is being activated -- **Activated**: Image is activated and running -- **Deactivating**: Image is being deactivated -- **Activate Failed**: Image activation failed -- **Ceased Billing**: Image has stopped billing - -## FAQ - -### Q: How to view command help? - -A: Add `--help` or `-h` parameter after any command: - -```bash -agb --help -agb image --help -agb image create --help -``` - -### Q: What to do if login fails? - -A: Please check: -1. Network connection is normal -2. Browser can access agb.cloud normally -3. You have a valid Google account -4. Firewall is not blocking the callback port - -### Q: What to do if image creation fails? - -A: Please check: -1. Dockerfile syntax is correct -2. Base image ID is valid -3. Network connection is stable -4. Check the Request ID in error messages for technical support - -### Q: How to view detailed execution information? - -A: Use `--verbose` or `-v` parameter: - -```bash -agb -v image create myImage -f ./Dockerfile -i agb-code-space-1 -``` - -### Q: What to do if image activation is slow? - -A: Image activation may take several minutes, especially when: -- First time activating a specific image -- Image is large -- System load is high - -Please be patient, the system will automatically monitor activation status. - -### Q: How to get base image IDs? - -A: Use the image list command to view system images: - -```bash -agb image list --type System -``` - ---- - -**Technical Support**: If you encounter issues, please contact the technical support team and provide relevant Request ID and Trace ID. \ No newline at end of file diff --git a/scripts/README.md b/scripts/README.md index 8dce1c4..1228378 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,75 +1,398 @@ -# AgbCloud CLI Scripts +# AgbCloud CLI User Guide -This directory contains scripts for the AgbCloud CLI project. +This guide will walk you through how to use the AgbCloud CLI tool for image management operations. -## Test Scripts +## Table of Contents -### test.sh +- [Prerequisites](#prerequisites) +- [1. Login Authentication](#1-login-authentication) +- [2. Create Image](#2-create-image) +- [3. Activate Image](#3-activate-image) +- [4. Deactivate Image](#4-deactivate-image) +- [5. List Images](#5-list-images) +- [FAQ](#faq) -The main test runner script used by the Makefile for running unit and integration tests. +## Prerequisites -#### Usage +Before getting started, please ensure: +- AgbCloud CLI tool is installed +- You have a valid AgbCloud account +- Network connection is available + +## 1. Login Authentication + +Before using any image management features, you need to log in to AgbCloud. + +### Command Syntax ```bash -# Run unit tests only -./scripts/test.sh --unit-only +agb login +``` + +### Usage Steps + +1. **Execute login command**: + ```bash + agb login + ``` + +2. **System response**: + ``` + [SEC] Starting AgbCloud authentication... + [SIGNAL] Using callback port: 8080 + [WEB] Requesting OAuth login URL... + [OK] Successfully retrieved OAuth URL! + [DOC] Request ID: req-xxxxx + [SEARCH] Trace ID: trace-xxxxx + + [>>] Starting local callback server on port 8080... + [LINK] OAuth URL: + https://agb.cloud/oauth/authorize?... + + [WEB] Opening the browser for authentication... + ``` -# Run integration tests only -./scripts/test.sh --integration-only +3. **Browser authentication**: + - CLI will automatically open the browser + - If the browser doesn't open automatically, manually copy the URL to your browser + - Complete Google account authentication in the browser -# Run all tests -./scripts/test.sh --all +4. **Authentication successful**: + ``` + [OK] Authentication successful! + [KEY] Received authorization code: abcd1234... + [REFRESH] Exchanging authorization code for access token... + [OK] Login successful! + ``` -# Run tests with verbose output -./scripts/test.sh --unit-only --verbose +### Notes + +- Login session has a certain validity period, re-login is required after expiration +- Login information is securely stored in local configuration files + +## 2. Create Image + +Creating custom images requires providing a Dockerfile and base image ID. + +### Command Syntax + +```bash +agb image create --dockerfile --imageId ``` -## Build and Release Scripts +### Parameter Description -### generate-server-files.sh +- ``: Custom image name (required) +- `--dockerfile, -f`: Dockerfile file path (required) +- `--imageId, -i`: Base image ID (required) -Generates server files and installation commands for distribution. This script is used in the CI/CD pipeline to create PowerShell installation scripts and version metadata. +### Usage Examples -#### Usage +```bash +# Full command +agb image create myCustomImage --dockerfile ./Dockerfile --imageId agb-code-space-1 + +# Using short parameters +agb image create myCustomImage -f ./Dockerfile -i agb-code-space-1 +``` + +### Execution Flow + +1. **Start creation**: + ``` + [BUILD] Creating image 'myCustomImage'... + [SIGNAL] Getting upload credentials... + [OK] Upload credentials obtained (Task ID: task-xxxxx) + ``` + +2. **Upload Dockerfile**: + ``` + [UPLOAD] Uploading Dockerfile... + [OK] Dockerfile uploaded successfully + ``` + +3. **Create image**: + ``` + [WORK] Creating image... + [OK] Image creation initiated + ``` + +4. **Monitor progress**: + ``` + [MONITOR] Monitoring image creation progress... + [DATA] Status: Creating + [DATA] Status: Available + [OK] Image creation completed successfully! + ``` + +### Image Status Description + +- **Creating**: Image is being created +- **Create Failed**: Image creation failed +- **Available**: Image creation completed and ready to use + +## 3. Activate Image + +Activating an image starts a running instance. You can specify CPU and memory resources. + +### Command Syntax ```bash -# Generate files for a specific version -VERSION="v1.2.3" ./scripts/generate-server-files.sh +agb image activate [--cpu ] [--memory ] +``` -# Generate files with default dev version -./scripts/generate-server-files.sh +### Parameter Description + +- ``: Image ID to activate (required) +- `--cpu, -c`: CPU cores (optional, must be used together with memory parameter) +- `--memory, -m`: Memory size in GB (optional, must be used together with CPU parameter) + +**Supported CPU/Memory combinations:** +- `2c4g`: 2 CPU cores + 4 GB memory +- `4c8g`: 4 CPU cores + 8 GB memory +- `8c16g`: 8 CPU cores + 16 GB memory + +**Note:** If CPU and memory parameters are not specified, default resource configuration will be used. If specified, both CPU and memory must be provided and must be one of the supported combinations above. + +### Usage Examples + +```bash +# Basic activation (using default resources) +agb image activate img-7a8b9c1d0e + +# Using 2c4g configuration +agb image activate img-7a8b9c1d0e --cpu 2 --memory 4 + +# Using 4c8g configuration +agb image activate img-7a8b9c1d0e --cpu 4 --memory 8 + +# Using 8c16g configuration +agb image activate img-7a8b9c1d0e --cpu 8 --memory 16 + +# Using short parameters +agb image activate img-7a8b9c1d0e -c 4 -m 8 ``` -#### Generated Files +### Execution Flow + +1. **Start activation**: + ``` + [>>] Activating image 'img-7a8b9c1d0e'... + [SAVE] CPU: 4 cores, Memory: 8 GB + [SEARCH] Checking current image status... + ``` + +2. **Status check**: + ``` + [DATA] Current Status: Available + [OK] Image is available, proceeding with activation... + [REFRESH] Starting image activation... + ``` + +3. **Activation successful**: + ``` + [OK] Image activation initiated successfully! + [DATA] Operation Status: true + [SEARCH] Request ID: req-xxxxx + ``` -- `server-files/install.ps1` - PowerShell installation script -- `server-files/latest.json` - Version metadata for API +4. **Monitor activation status**: + ``` + [MONITOR] Monitoring image activation status... + [DATA] Status: Activating + [DATA] Status: Activated + [OK] Image activation completed successfully! + ``` -### upload-to-oss.sh +### Image Activation Status Description -Uploads build artifacts to Alibaba Cloud OSS. Can be used independently or as part of the CI/CD pipeline. +- **Available**: Image is available but not activated +- **Activating**: Image is being activated +- **Activated**: Image is activated and running +- **Activate Failed**: Image activation failed +- **Ceased Billing**: Image has stopped billing -#### Usage +### Special Case Handling + +- If the image is already activated, the system will display the current status +- If the image is being activated, it will automatically join the monitoring process +- If the image is in a failed state, it will attempt to reactivate +- **If an invalid CPU/memory combination is specified, the system will show an error and display supported combinations** + +### Error Examples ```bash -# Set required environment variables -export OSS_ACCESS_KEY_ID="your-access-key" -export OSS_ACCESS_KEY_SECRET="your-secret-key" -export VERSION="v1.2.3" +# Invalid combination example +agb image activate img-7a8b9c1d0e --cpu 3 --memory 6 -# Upload packages -./scripts/upload-to-oss.sh +# Error output +[ERROR] Invalid CPU/Memory combination: 3c6g + +[TOOL] Supported combinations: + โ€ข 2c4g: --cpu 2 --memory 4 + โ€ข 4c8g: --cpu 4 --memory 8 + โ€ข 8c16g: --cpu 8 --memory 16 ``` -## Features +## 4. Deactivate Image + +Deactivate (stop) a running image instance. -- **Test Automation**: Comprehensive test runner with multiple modes -- **Build Integration**: Automatic generation of installation files for CI/CD -- **Cloud Storage**: Upload artifacts to OSS with proper permissions -- **Version Management**: Support for version-specific builds and releases +### Command Syntax + +```bash +agb image deactivate +``` + +### Parameter Description + +- ``: Image ID to deactivate (required) + +### Usage Examples + +```bash +agb image deactivate img-7a8b9c1d0e +``` + +### Execution Flow + +1. **Start deactivation**: + ``` + ๐Ÿ›‘ Deactivating image 'img-7a8b9c1d0e'... + [REFRESH] Deactivating image instance... + ``` + +2. **Deactivation successful**: + ``` + [OK] Image deactivation initiated successfully! + [DATA] Operation Status: true + [SEARCH] Request ID: req-xxxxx + ``` + +### Notes + +- Deactivating an image will terminate the running instance +- The image status will change to "Available" after deactivation +- Deactivation operation usually takes effect immediately + +## 5. List Images + +View your image list with pagination and type filtering support. + +### Command Syntax + +```bash +agb image list [--type ] [--page ] [--size ] +``` + +### Parameter Description + +- `--type, -t`: Image type, options: + - `User`: User custom images (default) + - `System`: System-provided base images +- `--page, -p`: Page number, default is 1 +- `--size, -s`: Items per page, default is 10 + +### Usage Examples + +```bash +# View user images (default) +agb image list + +# View system images +agb image list --type System + +# Paginated view +agb image list --page 2 --size 5 + +# Using short parameters +agb image list -t User -p 1 -s 20 +``` + +### Output Example + +``` +[DOC] Listing User images (Page 1, Size 10)... +[SEARCH] Fetching image list... +[OK] Found 3 images (Total: 3) +[PAGE] Page 1 of 1 (Page Size: 10) + +IMAGE ID IMAGE NAME STATUS TYPE UPDATED AT +-------- ---------- ------ ---- ---------- +img-7a8b9c1d0e myCustomImage Available User 2025-01-15 10:30 +img-2f3g4h5i6j webAppImage Activated User 2025-01-15 09:15 +img-8k9l0m1n2o dataProcessImage Creating User 2025-01-15 11:45 +``` + +### Status Description + +Images can be in the following states: + +**Creation-related statuses:** +- **Creating**: Image is being created +- **Create Failed**: Image creation failed +- **Available**: Image creation completed and ready to use + +**Activation-related statuses:** +- **Activating**: Image is being activated +- **Activated**: Image is activated and running +- **Deactivating**: Image is being deactivated +- **Activate Failed**: Image activation failed +- **Ceased Billing**: Image has stopped billing + +## FAQ + +### Q: How to view command help? + +A: Add `--help` or `-h` parameter after any command: + +```bash +agb --help +agb image --help +agb image create --help +``` + +### Q: What to do if login fails? + +A: Please check: +1. Network connection is normal +2. Browser can access agb.cloud normally +3. You have a valid Google account +4. Firewall is not blocking the callback port + +### Q: What to do if image creation fails? + +A: Please check: +1. Dockerfile syntax is correct +2. Base image ID is valid +3. Network connection is stable +4. Check the Request ID in error messages for technical support + +### Q: How to view detailed execution information? + +A: Use `--verbose` or `-v` parameter: + +```bash +agb -v image create myImage -f ./Dockerfile -i agb-code-space-1 +``` + +### Q: What to do if image activation is slow? + +A: Image activation may take several minutes, especially when: +- First time activating a specific image +- Image is large +- System load is high + +Please be patient, the system will automatically monitor activation status. + +### Q: How to get base image IDs? + +A: Use the image list command to view system images: + +```bash +agb image list --type System +``` -## Compatibility +--- -- Linux/macOS build environments -- Alibaba Cloud OSS integration -- Go 1.23+ test framework \ No newline at end of file +**Technical Support**: If you encounter issues, please contact the technical support team and provide relevant Request ID and Trace ID. \ No newline at end of file diff --git a/scripts/generate-server-files.sh b/scripts/generate-server-files.sh deleted file mode 100755 index 7293a40..0000000 --- a/scripts/generate-server-files.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - -# Generate server files for AgbCloud CLI distribution -# This script creates only the essential files needed for PowerShell installation - -set -e - -VERSION=${VERSION:-"dev-$(date +%Y%m%d-%H%M)"} -BASE_URL="https://agbcloud-internal.oss-cn-hangzhou.aliyuncs.com" - -echo "[>>] Generating PowerShell installer files for version: $VERSION" - -# Create output directory -# Handle both running from root directory and from scripts directory -if [[ -d "scripts" ]]; then - # Running from root directory - mkdir -p server-files - OUTPUT_DIR="server-files" -else - # Running from scripts directory - mkdir -p ../server-files - OUTPUT_DIR="../server-files" -fi - -# 1. Generate latest.json for version API (essential for PowerShell script) -echo "[PAGE] Creating latest.json..." -cat > $OUTPUT_DIR/latest.json << EOF -{ - "version": "$VERSION", - "releaseDate": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")", - "windows": { - "amd64": { - "url": "$BASE_URL/agb-$VERSION-windows-amd64.exe", - "sha256": "$(cat packages/agb-$VERSION-windows-amd64.exe.sha256 2>/dev/null | cut -d' ' -f1 || echo 'PLACEHOLDER_SHA256')" - }, - "arm64": { - "url": "$BASE_URL/agb-$VERSION-windows-arm64.exe", - "sha256": "$(cat packages/agb-$VERSION-windows-arm64.exe.sha256 2>/dev/null | cut -d' ' -f1 || echo 'PLACEHOLDER_SHA256')" - } - } -} -EOF - -# 2. Generate install.ps1 (the main PowerShell installer) -echo "[PAGE] Creating install.ps1..." -# Copy the PowerShell installer script (it dynamically fetches latest version) -# Handle both running from root directory and from scripts directory -if [[ -f "scripts/install-windows-simple.ps1" ]]; then - cp scripts/install-windows-simple.ps1 $OUTPUT_DIR/install.ps1 -elif [[ -f "install-windows-simple.ps1" ]]; then - cp install-windows-simple.ps1 $OUTPUT_DIR/install.ps1 -else - echo "Error: Could not find install-windows-simple.ps1" - exit 1 -fi - -echo "[OK] PowerShell installer files generated successfully!" -echo "" -echo "[DIR] Generated files:" -ls -la $OUTPUT_DIR/ -echo "" -echo "[>>] Upload these files to your OSS bucket:" -echo " - server-files/install.ps1 โ†’ $BASE_URL/install.ps1" -echo " - server-files/latest.json โ†’ $BASE_URL/latest.json" -echo " - packages/*.exe โ†’ $BASE_URL/" -echo " - packages/*.exe.sha256 โ†’ $BASE_URL/" -echo "" -echo "[DOC] Windows Installation Commands:" -echo "" -echo "[REFRESH] Install Latest Version (recommended for production):" -echo " powershell -Command \"irm $BASE_URL/install.ps1 | iex\"" -echo "" -echo "[AIM] Install Specific Version $VERSION (for testing):" -echo " powershell -Command \"irm $BASE_URL/install.ps1 | iex\" -Version $VERSION" -echo "" -echo "[BOOK] Additional Options:" -echo " # Install to custom directory" -echo " powershell -Command \"irm $BASE_URL/install.ps1 | iex\" -InstallPath \"C:\\Tools\\agb\"" -echo "" -echo " # Install specific architecture" -echo " powershell -Command \"irm $BASE_URL/install.ps1 | iex\" -Architecture arm64" -echo "" -echo " # Show help" -echo " powershell -Command \"irm $BASE_URL/install.ps1 | iex\" -Help" -echo "" -echo "[TIP] Testing Team Usage:" -echo " Use the specific version command above to test version $VERSION" -echo " Use the latest version command for general testing" \ No newline at end of file diff --git a/scripts/index.html b/scripts/index.html new file mode 100644 index 0000000..e2dfc2c --- /dev/null +++ b/scripts/index.html @@ -0,0 +1,172 @@ + + + + + + AgbCloud CLI - Installation + + + +
+ +
Command Line Interface for AgbCloud Platform
+
+ +
+

๐Ÿš€ Quick Installation

+

Install AgbCloud CLI with a single command:

+ +

Windows (PowerShell)

+
powershell -Command "irm https://agbcloud.github.io/agbcloud-cli/windows | iex"
+ + +

Alternative Installation Methods

+

You can also download binaries directly from our GitHub Releases page.

+
+ +
+
+

๐Ÿ”ง Easy Installation

+

One-command installation with automatic PATH configuration and architecture detection.

+
+
+

๐Ÿ”„ Auto Updates

+

Built-in version checking and upgrade capabilities to keep your CLI up-to-date.

+
+
+

๐Ÿ—๏ธ Cross Platform

+

Supports Windows (amd64/arm64) with plans for macOS and Linux support.

+
+
+

๐Ÿ›ก๏ธ Secure

+

Downloads from official GitHub releases with integrity verification.

+
+
+ +
+

๐Ÿ“– Quick Start

+

After installation, get started with these commands:

+
+# Show help +agb --help + +# Show version +agb version + +# Login to AgbCloud +agb login + +# List available images +agb image list +
+
+ + + + + + \ No newline at end of file diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index 0768643..0000000 --- a/scripts/test.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash - -# Copyright 2025 AgbCloud CLI Contributors -# SPDX-License-Identifier: Apache-2.0 - -set -e - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -NC='\033[0m' # No Color - -# Function to print colored output -print_status() { - echo -e "${GREEN}[INFO]${NC} $1" -} - -print_warning() { - echo -e "${YELLOW}[WARN]${NC} $1" -} - -print_error() { - echo -e "${RED}[ERROR]${NC} $1" -} - -# Default values -RUN_UNIT=true -RUN_INTEGRATION=false -VERBOSE=false - -# Parse command line arguments -while [[ $# -gt 0 ]]; do - case $1 in - --unit-only) - RUN_UNIT=true - RUN_INTEGRATION=false - shift - ;; - --integration-only) - RUN_UNIT=false - RUN_INTEGRATION=true - shift - ;; - --all) - RUN_UNIT=true - RUN_INTEGRATION=true - shift - ;; - --verbose|-v) - VERBOSE=true - shift - ;; - --help|-h) - echo "Usage: $0 [OPTIONS]" - echo "" - echo "Options:" - echo " --unit-only Run only unit tests (default)" - echo " --integration-only Run only integration tests" - echo " --all Run both unit and integration tests" - echo " --verbose, -v Enable verbose output" - echo " --help, -h Show this help message" - echo "" - echo "Environment Variables:" - echo " SKIP_INTEGRATION_TESTS Set to 'true' to skip integration tests" - exit 0 - ;; - *) - print_error "Unknown option: $1" - echo "Use --help for usage information" - exit 1 - ;; - esac -done - -# Set verbose flag for go test -VERBOSE_FLAG="" -if [ "$VERBOSE" = true ]; then - VERBOSE_FLAG="-v" -fi - -# Change to project root directory -cd "$(dirname "$0")/.." - -print_status "Starting test execution..." - -# Run unit tests -if [ "$RUN_UNIT" = true ]; then - print_status "Running unit tests..." - - if go test $VERBOSE_FLAG ./test/unit/...; then - print_status "[OK] Unit tests passed" - else - print_error "[ERROR] Unit tests failed" - exit 1 - fi - - # Also run tests for internal packages (excluding integration tests) - print_status "Running internal package tests..." - if go test $VERBOSE_FLAG ./internal/...; then - print_status "[OK] Internal package tests passed" - else - print_error "[ERROR] Internal package tests failed" - exit 1 - fi -fi - -# Run integration tests -if [ "$RUN_INTEGRATION" = true ]; then - print_status "Running integration tests..." - - # Check if integration tests should be skipped - if [ "$SKIP_INTEGRATION_TESTS" = "true" ]; then - print_warning "[WARN] Integration tests skipped (SKIP_INTEGRATION_TESTS=true)" - else - print_status "Running integration tests against real API..." - print_warning "Note: Integration tests WILL FAIL if network connectivity to https://agb.cloud is unavailable" - - if go test $VERBOSE_FLAG -timeout=45m -tags=integration ./test/integration/...; then - print_status "[OK] Integration tests passed" - else - print_error "[ERROR] Integration tests failed" - print_warning "Common causes:" - print_warning " - Network connectivity issues to https://agb.cloud" - print_warning " - API endpoint changes or service unavailability" - print_warning " - Firewall or proxy blocking HTTPS requests" - print_warning "If you want to skip integration tests, set SKIP_INTEGRATION_TESTS=true" - # Don't exit with error for integration tests as they may fail due to external dependencies - fi - fi -fi - -print_status "Test execution completed!" - -# Run coverage if requested -if [ "$VERBOSE" = true ]; then - print_status "Generating test coverage report..." - go test -coverprofile=coverage.out ./test/unit/... ./internal/... - go tool cover -html=coverage.out -o coverage.html - print_status "Coverage report generated: coverage.html" -fi \ No newline at end of file diff --git a/scripts/upload-to-oss.sh b/scripts/upload-to-oss.sh deleted file mode 100644 index a868beb..0000000 --- a/scripts/upload-to-oss.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/bash -# Upload packages to Alibaba Cloud OSS -set -e - -# OSS Configuration -OSS_ENDPOINT="oss-cn-hangzhou.aliyuncs.com" -OSS_BUCKET="agbcloud-internal" -OSS_PREFIX="agbcloud/releases" - -# Package directory -PACKAGE_DIR=${PACKAGE_DIR:-"packages"} -VERSION=${VERSION:-"dev-$(date +%Y%m%d-%H%M)"} - -echo "Uploading packages to OSS..." -echo "Endpoint: $OSS_ENDPOINT" -echo "Bucket: $OSS_BUCKET" -echo "Prefix: $OSS_PREFIX" -echo "Version: $VERSION" - -# Check required environment variables -if [[ -z "$OSS_ACCESS_KEY_ID" ]]; then - echo "Error: OSS_ACCESS_KEY_ID environment variable is not set" - exit 1 -fi - -if [[ -z "$OSS_ACCESS_KEY_SECRET" ]]; then - echo "Error: OSS_ACCESS_KEY_SECRET environment variable is not set" - exit 1 -fi - -# Check if package directory exists -if [[ ! -d "$PACKAGE_DIR" ]]; then - echo "Error: Package directory '$PACKAGE_DIR' not found" - exit 1 -fi - -# Check if ossutil is installed -if ! command -v ossutil >/dev/null 2>&1; then - echo "Installing ossutil..." - - # Download and install ossutil - if [[ "$OSTYPE" == "darwin"* ]]; then - # macOS - if [[ "$(uname -m)" == "arm64" ]]; then - OSSUTIL_URL="https://gosspublic.alicdn.com/ossutil/1.7.19/ossutil-v1.7.19-darwin-arm64.zip" - else - OSSUTIL_URL="https://gosspublic.alicdn.com/ossutil/1.7.19/ossutil-v1.7.19-darwin-amd64.zip" - fi - else - # Linux - OSSUTIL_URL="https://gosspublic.alicdn.com/ossutil/1.7.19/ossutil-v1.7.19-linux-amd64.zip" - fi - - curl -L "$OSSUTIL_URL" -o ossutil.zip - unzip -q ossutil.zip - chmod +x ossutil* - sudo mv ossutil* /usr/local/bin/ossutil - rm -f ossutil.zip - - echo "[OK] ossutil installed successfully" -fi - -# Configure ossutil -echo "Configuring ossutil..." -ossutil config -e "$OSS_ENDPOINT" -i "$OSS_ACCESS_KEY_ID" -k "$OSS_ACCESS_KEY_SECRET" - -# Upload all package files -echo "Uploading packages..." -upload_count=0 - -for package in "$PACKAGE_DIR"/*.tar.gz; do - if [[ -f "$package" ]]; then - filename=$(basename "$package") - oss_path="oss://$OSS_BUCKET/$OSS_PREFIX/$filename" - - echo "Uploading $filename..." - - # Upload the package - if ossutil cp "$package" "$oss_path" --force; then - echo "[OK] Uploaded: $filename" - - # Set public read permission - if ossutil set-acl "$oss_path" public-read; then - echo "[OK] Set public-read ACL for: $filename" - else - echo "[WARN] Failed to set ACL for: $filename" - fi - - # Generate public URL - public_url="https://$OSS_BUCKET.$OSS_ENDPOINT/$OSS_PREFIX/$filename" - echo " Public URL: $public_url" - - upload_count=$((upload_count + 1)) - else - echo "[ERROR] Failed to upload: $filename" - exit 1 - fi - fi -done - -# Upload SHA256 files -echo "Uploading SHA256 files..." -for sha256_file in "$PACKAGE_DIR"/*.sha256; do - if [[ -f "$sha256_file" ]]; then - filename=$(basename "$sha256_file") - oss_path="oss://$OSS_BUCKET/$OSS_PREFIX/$filename" - - echo "Uploading $filename..." - - if ossutil cp "$sha256_file" "$oss_path" --force; then - echo "[OK] Uploaded: $filename" - - # Set public read permission - ossutil set-acl "$oss_path" public-read - else - echo "[WARN] Failed to upload: $filename" - fi - fi -done - -echo "" -echo "Upload completed successfully!" -echo "Total packages uploaded: $upload_count" -echo "" -echo "Download URLs:" -for package in "$PACKAGE_DIR"/*.tar.gz; do - if [[ -f "$package" ]]; then - filename=$(basename "$package") - echo " https://$OSS_BUCKET.$OSS_ENDPOINT/$OSS_PREFIX/$filename" - fi -done \ No newline at end of file diff --git a/scripts/windows b/scripts/windows new file mode 100644 index 0000000..c9b58ac --- /dev/null +++ b/scripts/windows @@ -0,0 +1,263 @@ +# PowerShell script to download and install AgbCloud CLI binary from GitHub Releases + +param( + [string]$Version = "", + [string]$Architecture = "", + [string]$InstallPath = "", + [switch]$Help +) + +# Show help information +if ($Help) { + Write-Host "AgbCloud CLI Installation Script" + Write-Host "" + Write-Host "Usage:" + Write-Host " powershell -Command `"irm https://agbcloud.github.io/agbcloud-cli/windows | iex`"" + Write-Host "" + Write-Host "Options:" + Write-Host " -Version Specify version to install (e.g., 'v1.0.0', 'v1.2.3', 'latest')" + Write-Host " -Architecture Specify architecture ('amd64' or 'arm64')" + Write-Host " -InstallPath Specify custom installation directory" + Write-Host " -Help Show this help message" + Write-Host "" + Write-Host "Environment Variables:" + Write-Host " AGBCLOUD_VERSION Default version to install" + Write-Host " AGBCLOUD_PATH Default installation directory" + Write-Host "" + Write-Host "Examples:" + Write-Host " # Install default version (v1.0.0)" + Write-Host " powershell -Command `"irm https://agbcloud.github.io/agbcloud-cli/windows | iex`"" + Write-Host "" + exit 0 +} + +# Determine architecture +if (-not $Architecture) { + $Architecture = if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64") { + "amd64" + } elseif ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { + "arm64" + } else { + "amd64" + } +} + +# GitHub repository information +$repoOwner = "agbcloud" +$repoName = "agbcloud-cli" +$githubApiUrl = "https://api.github.com/repos/$repoOwner/$repoName" + +# Installation directory +$destination = if ($InstallPath) { + $InstallPath +} elseif ($env:AGBCLOUD_PATH) { + $env:AGBCLOUD_PATH +} else { + "$env:LOCALAPPDATA\agbcloud" +} + +Write-Host "[INFO] Installing AgbCloud CLI..." +Write-Host "" + +# Determine version with parameter priority +$version = if ($Version) { + $Version +} elseif ($env:AGBCLOUD_VERSION) { + $env:AGBCLOUD_VERSION +} else { + "latest" # Default to latest version +} + +# Get latest version if needed +if ($version -eq "latest") { + Write-Host "[INFO] Fetching latest version..." + + # Try using git to get latest tag (no API calls, no 403 errors) + try { + Write-Host "[INFO] Getting latest tag using git..." + $gitVersion = git ls-remote --tags --sort=-version:refname "https://github.com/$repoOwner/$repoName.git" | Select-Object -First 1 | ForEach-Object { ($_ -split '\s+')[1] -replace 'refs/tags/', '' } + if ($gitVersion -and $gitVersion -match '^v?\d+\.\d+\.\d+') { + $version = $gitVersion + Write-Host "[SUCCESS] Found latest version: $version" + } else { + throw "Git method failed or returned invalid version" + } + } catch { + Write-Host "[WARN] Git method failed: $($_.Exception.Message)" + Write-Host "[INFO] Using fallback version v1.0.0" + Write-Host "[TIP] You can specify a version manually using: -Version v1.2.3" + Write-Host "[TIP] Check available versions at: https://github.com/$repoOwner/$repoName/releases" + $version = "v1.0.0" + } + +} else { + Write-Host "[INFO] Installing specified version: $version" +} + +# Construct download URL +# Remove 'v' prefix from version for binary name, but keep original version for download tag +$versionForBinary = $version.TrimStart('v') +$binaryName = "agb-$versionForBinary-windows-$Architecture.exe" +$downloadUrl = "https://github.com/$repoOwner/$repoName/releases/download/$version/$binaryName" + +# Display installation info +Write-Host "Installation Details:" +Write-Host " Repository: https://github.com/$repoOwner/$repoName" +Write-Host " Version: $version" +Write-Host " Architecture: $Architecture" +Write-Host " Binary: $binaryName" +Write-Host " Installation directory: $destination" +Write-Host " Download URL: $downloadUrl" +Write-Host "" + +# Create destination directory if it doesn't exist +try { + if (!(Test-Path -Path $destination)) { + Write-Host "[INFO] Creating installation directory at $destination" + New-Item -ItemType Directory -Force -Path $destination -ErrorAction Stop | Out-Null + } +} catch { + Write-Error "[ERROR] Failed to create installation directory: $_" + exit 1 +} + +# File to download +$outputFile = "$destination\agb.exe" + +# Check if already installed and get current version +$upgrading = $false +if (Test-Path $outputFile) { + try { + $currentVersionOutput = & $outputFile version 2>$null + if ($currentVersionOutput -match "version\s+([v\d\.]+)") { + $currentVersion = $matches[1] + if ($currentVersion -eq $version.TrimStart('v')) { + Write-Host "[SUCCESS] AgbCloud CLI $version is already installed!" + Write-Host " Location: $outputFile" + Write-Host "" + Write-Host "[INFO] You're all set! Use 'agb --help' to get started." + exit 0 + } else { + Write-Host "[INFO] Upgrading from $currentVersion to $version" + $upgrading = $true + } + } else { + Write-Host "[INFO] Existing installation found, upgrading..." + $upgrading = $true + } + } catch { + Write-Host "[INFO] Existing installation found, upgrading..." + $upgrading = $true + } + Write-Host "" +} + +# Download the file with progress +try { + if ($upgrading) { + Write-Host "[INFO] Downloading AgbCloud CLI update..." + } else { + Write-Host "[INFO] Downloading AgbCloud CLI..." + } + Write-Host " From: $downloadUrl" + Write-Host " To: $outputFile" + + # Use Invoke-WebRequest with progress + $ProgressPreference = 'Continue' + Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile -UseBasicParsing -ErrorAction Stop + + Write-Host "" + Write-Host "[SUCCESS] Download complete!" +} catch { + Write-Error "[ERROR] Failed to download AgbCloud CLI: $_" + Write-Host "" + Write-Host "Troubleshooting:" + Write-Host " 1. Check your internet connection" + Write-Host " 2. Verify the version exists: https://github.com/$repoOwner/$repoName/releases" + Write-Host " 3. Try the default version: -Version v1.0.0" + Write-Host " 4. Try a different version: -Version v1.2.3" + Write-Host " 5. Check if the architecture is correct: -Architecture amd64" + Write-Host " 6. Use custom install path: -InstallPath C:\MyTools" + exit 1 +} + +# Set executable permissions (Windows doesn't need this, but good practice) +try { + Write-Host "[INFO] Setting up binary permissions..." + Set-ItemProperty -Path $outputFile -Name IsReadOnly -Value $false -ErrorAction SilentlyContinue +} catch { + Write-Host " [WARN] Could not set binary permissions (this is usually fine on Windows)" +} + +# Add to PATH if not already present +try { + Write-Host "[INFO] Updating PATH environment variable..." + + $currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::User) + if (-not $currentPath) { $currentPath = "" } + + $pathEntries = $currentPath -split ';' | ForEach-Object { $_.TrimEnd('\') } + + if (-not ($pathEntries | Where-Object { $_ -eq $destination })) { + Write-Host " Adding $destination to user PATH..." + $newPath = if ($currentPath.EndsWith(';')) { "$currentPath$destination" } else { "$currentPath;$destination" } + [System.Environment]::SetEnvironmentVariable("Path", $newPath, [System.EnvironmentVariableTarget]::User) + Write-Host "[SUCCESS] PATH updated successfully!" + Write-Host " [TIP] Please restart your terminal or run a new PowerShell session" + } else { + Write-Host "[SUCCESS] Already in PATH" + } +} catch { + Write-Host " [WARN] Could not automatically update PATH" + Write-Host " [MANUAL] Please manually add the following to your PATH:" + Write-Host " $destination" + Write-Host "" + Write-Host " [STEPS] To add manually:" + Write-Host " 1. Press Win+R, type 'sysdm.cpl', press Enter" + Write-Host " 2. Click 'Environment Variables'" + Write-Host " 3. Under 'User variables', select 'Path' and click 'Edit'" + Write-Host " 4. Click 'New' and add: $destination" + Write-Host " 5. Click OK to save" +} + +Write-Host "" + +# Test installation +Write-Host "[INFO] Testing installation..." +try { + $installedVersion = & $outputFile version 2>$null + if ($installedVersion) { + Write-Host "[SUCCESS] Installation test successful!" + Write-Host "" + + if ($upgrading) { + Write-Host "[SUCCESS] AgbCloud CLI successfully upgraded to $version!" + } else { + Write-Host "[SUCCESS] AgbCloud CLI $version installed successfully!" + } + + Write-Host " Location: $outputFile" + Write-Host " Version: $installedVersion" + Write-Host "" + Write-Host "Quick Start:" + Write-Host " agb --help # Show help" + Write-Host " agb version # Show version" + Write-Host " agb login # Login to AgbCloud" + Write-Host "" + Write-Host "Documentation:" + Write-Host " https://github.com/$repoOwner/$repoName" + Write-Host "" + Write-Host "[SUCCESS] Installation completed! " + } else { + Write-Host "[WARN] Installation completed but version check failed" + Write-Host " This might be normal if the binary requires additional setup" + Write-Host " Try running: $outputFile --help" + } +} catch { + Write-Host "[WARN] Installation completed but test failed: $_" + Write-Host " This might be normal if the binary requires additional setup" + Write-Host " Try running: $outputFile --help" +} + +Write-Host "" +Write-Host "Thank you for using AgbCloud CLI! " \ No newline at end of file From 8d16ee77e4c0045d92a95f409de6e6d79bfbcba8 Mon Sep 17 00:00:00 2001 From: litiantain Date: Fri, 17 Oct 2025 14:07:04 +0800 Subject: [PATCH 2/4] docs: translate comments in homebrew.yml to English --- .github/workflows/homebrew.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.yml index 86b31dc..3caaf97 100644 --- a/.github/workflows/homebrew.yml +++ b/.github/workflows/homebrew.yml @@ -544,17 +544,17 @@ jobs: run: | echo "๐Ÿ“ Preparing GitHub Pages deployment from scripts directory..." - # ็กฎไฟscripts็›ฎๅฝ•ๅญ˜ๅœจ + # Ensure scripts directory exists if [ ! -d "scripts" ]; then echo "โŒ scripts directory not found!" exit 1 fi - # ๆ˜พ็คบๅฐ†่ฆ้ƒจ็ฝฒ็š„ๆ–‡ไปถ + # Display files to be deployed echo "Files to be deployed:" ls -la scripts/ - # ้ชŒ่ฏๅ…ณ้”ฎๆ–‡ไปถๅญ˜ๅœจ + # Verify critical files exist if [ ! -f "scripts/windows" ]; then echo "โŒ scripts/windows file not found!" exit 1 @@ -580,7 +580,7 @@ jobs: run: | echo "๐ŸŽ‰ GitHub Pages deployment completed!" echo "๐Ÿ“„ Site URL: ${{ steps.deployment.outputs.page_url }}" - echo "๐Ÿ”— Install command: powershell -Command \"irm https://litiantian123-code.github.io/agbcloud-cli/windows | iex\"" + echo "๐Ÿ”— Install command: powershell -Command \"irm https://agbcloud.github.io/agbcloud-cli/windows | iex\"" - name: Validate Official Formula run: | From 00352fbefb582e753fd68cfa3c4e172df773f310 Mon Sep 17 00:00:00 2001 From: litiantain Date: Fri, 17 Oct 2025 15:21:00 +0800 Subject: [PATCH 3/4] docs: update README for callback port description --- docs/USER_GUIDE.md | 398 +++++++++++++++++++++++++++++++++++++++++++++ scripts/README.md | 4 +- 2 files changed, 400 insertions(+), 2 deletions(-) create mode 100644 docs/USER_GUIDE.md diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.md new file mode 100644 index 0000000..1228378 --- /dev/null +++ b/docs/USER_GUIDE.md @@ -0,0 +1,398 @@ +# AgbCloud CLI User Guide + +This guide will walk you through how to use the AgbCloud CLI tool for image management operations. + +## Table of Contents + +- [Prerequisites](#prerequisites) +- [1. Login Authentication](#1-login-authentication) +- [2. Create Image](#2-create-image) +- [3. Activate Image](#3-activate-image) +- [4. Deactivate Image](#4-deactivate-image) +- [5. List Images](#5-list-images) +- [FAQ](#faq) + +## Prerequisites + +Before getting started, please ensure: +- AgbCloud CLI tool is installed +- You have a valid AgbCloud account +- Network connection is available + +## 1. Login Authentication + +Before using any image management features, you need to log in to AgbCloud. + +### Command Syntax + +```bash +agb login +``` + +### Usage Steps + +1. **Execute login command**: + ```bash + agb login + ``` + +2. **System response**: + ``` + [SEC] Starting AgbCloud authentication... + [SIGNAL] Using callback port: 8080 + [WEB] Requesting OAuth login URL... + [OK] Successfully retrieved OAuth URL! + [DOC] Request ID: req-xxxxx + [SEARCH] Trace ID: trace-xxxxx + + [>>] Starting local callback server on port 8080... + [LINK] OAuth URL: + https://agb.cloud/oauth/authorize?... + + [WEB] Opening the browser for authentication... + ``` + +3. **Browser authentication**: + - CLI will automatically open the browser + - If the browser doesn't open automatically, manually copy the URL to your browser + - Complete Google account authentication in the browser + +4. **Authentication successful**: + ``` + [OK] Authentication successful! + [KEY] Received authorization code: abcd1234... + [REFRESH] Exchanging authorization code for access token... + [OK] Login successful! + ``` + +### Notes + +- Login session has a certain validity period, re-login is required after expiration +- Login information is securely stored in local configuration files + +## 2. Create Image + +Creating custom images requires providing a Dockerfile and base image ID. + +### Command Syntax + +```bash +agb image create --dockerfile --imageId +``` + +### Parameter Description + +- ``: Custom image name (required) +- `--dockerfile, -f`: Dockerfile file path (required) +- `--imageId, -i`: Base image ID (required) + +### Usage Examples + +```bash +# Full command +agb image create myCustomImage --dockerfile ./Dockerfile --imageId agb-code-space-1 + +# Using short parameters +agb image create myCustomImage -f ./Dockerfile -i agb-code-space-1 +``` + +### Execution Flow + +1. **Start creation**: + ``` + [BUILD] Creating image 'myCustomImage'... + [SIGNAL] Getting upload credentials... + [OK] Upload credentials obtained (Task ID: task-xxxxx) + ``` + +2. **Upload Dockerfile**: + ``` + [UPLOAD] Uploading Dockerfile... + [OK] Dockerfile uploaded successfully + ``` + +3. **Create image**: + ``` + [WORK] Creating image... + [OK] Image creation initiated + ``` + +4. **Monitor progress**: + ``` + [MONITOR] Monitoring image creation progress... + [DATA] Status: Creating + [DATA] Status: Available + [OK] Image creation completed successfully! + ``` + +### Image Status Description + +- **Creating**: Image is being created +- **Create Failed**: Image creation failed +- **Available**: Image creation completed and ready to use + +## 3. Activate Image + +Activating an image starts a running instance. You can specify CPU and memory resources. + +### Command Syntax + +```bash +agb image activate [--cpu ] [--memory ] +``` + +### Parameter Description + +- ``: Image ID to activate (required) +- `--cpu, -c`: CPU cores (optional, must be used together with memory parameter) +- `--memory, -m`: Memory size in GB (optional, must be used together with CPU parameter) + +**Supported CPU/Memory combinations:** +- `2c4g`: 2 CPU cores + 4 GB memory +- `4c8g`: 4 CPU cores + 8 GB memory +- `8c16g`: 8 CPU cores + 16 GB memory + +**Note:** If CPU and memory parameters are not specified, default resource configuration will be used. If specified, both CPU and memory must be provided and must be one of the supported combinations above. + +### Usage Examples + +```bash +# Basic activation (using default resources) +agb image activate img-7a8b9c1d0e + +# Using 2c4g configuration +agb image activate img-7a8b9c1d0e --cpu 2 --memory 4 + +# Using 4c8g configuration +agb image activate img-7a8b9c1d0e --cpu 4 --memory 8 + +# Using 8c16g configuration +agb image activate img-7a8b9c1d0e --cpu 8 --memory 16 + +# Using short parameters +agb image activate img-7a8b9c1d0e -c 4 -m 8 +``` + +### Execution Flow + +1. **Start activation**: + ``` + [>>] Activating image 'img-7a8b9c1d0e'... + [SAVE] CPU: 4 cores, Memory: 8 GB + [SEARCH] Checking current image status... + ``` + +2. **Status check**: + ``` + [DATA] Current Status: Available + [OK] Image is available, proceeding with activation... + [REFRESH] Starting image activation... + ``` + +3. **Activation successful**: + ``` + [OK] Image activation initiated successfully! + [DATA] Operation Status: true + [SEARCH] Request ID: req-xxxxx + ``` + +4. **Monitor activation status**: + ``` + [MONITOR] Monitoring image activation status... + [DATA] Status: Activating + [DATA] Status: Activated + [OK] Image activation completed successfully! + ``` + +### Image Activation Status Description + +- **Available**: Image is available but not activated +- **Activating**: Image is being activated +- **Activated**: Image is activated and running +- **Activate Failed**: Image activation failed +- **Ceased Billing**: Image has stopped billing + +### Special Case Handling + +- If the image is already activated, the system will display the current status +- If the image is being activated, it will automatically join the monitoring process +- If the image is in a failed state, it will attempt to reactivate +- **If an invalid CPU/memory combination is specified, the system will show an error and display supported combinations** + +### Error Examples + +```bash +# Invalid combination example +agb image activate img-7a8b9c1d0e --cpu 3 --memory 6 + +# Error output +[ERROR] Invalid CPU/Memory combination: 3c6g + +[TOOL] Supported combinations: + โ€ข 2c4g: --cpu 2 --memory 4 + โ€ข 4c8g: --cpu 4 --memory 8 + โ€ข 8c16g: --cpu 8 --memory 16 +``` + +## 4. Deactivate Image + +Deactivate (stop) a running image instance. + +### Command Syntax + +```bash +agb image deactivate +``` + +### Parameter Description + +- ``: Image ID to deactivate (required) + +### Usage Examples + +```bash +agb image deactivate img-7a8b9c1d0e +``` + +### Execution Flow + +1. **Start deactivation**: + ``` + ๐Ÿ›‘ Deactivating image 'img-7a8b9c1d0e'... + [REFRESH] Deactivating image instance... + ``` + +2. **Deactivation successful**: + ``` + [OK] Image deactivation initiated successfully! + [DATA] Operation Status: true + [SEARCH] Request ID: req-xxxxx + ``` + +### Notes + +- Deactivating an image will terminate the running instance +- The image status will change to "Available" after deactivation +- Deactivation operation usually takes effect immediately + +## 5. List Images + +View your image list with pagination and type filtering support. + +### Command Syntax + +```bash +agb image list [--type ] [--page ] [--size ] +``` + +### Parameter Description + +- `--type, -t`: Image type, options: + - `User`: User custom images (default) + - `System`: System-provided base images +- `--page, -p`: Page number, default is 1 +- `--size, -s`: Items per page, default is 10 + +### Usage Examples + +```bash +# View user images (default) +agb image list + +# View system images +agb image list --type System + +# Paginated view +agb image list --page 2 --size 5 + +# Using short parameters +agb image list -t User -p 1 -s 20 +``` + +### Output Example + +``` +[DOC] Listing User images (Page 1, Size 10)... +[SEARCH] Fetching image list... +[OK] Found 3 images (Total: 3) +[PAGE] Page 1 of 1 (Page Size: 10) + +IMAGE ID IMAGE NAME STATUS TYPE UPDATED AT +-------- ---------- ------ ---- ---------- +img-7a8b9c1d0e myCustomImage Available User 2025-01-15 10:30 +img-2f3g4h5i6j webAppImage Activated User 2025-01-15 09:15 +img-8k9l0m1n2o dataProcessImage Creating User 2025-01-15 11:45 +``` + +### Status Description + +Images can be in the following states: + +**Creation-related statuses:** +- **Creating**: Image is being created +- **Create Failed**: Image creation failed +- **Available**: Image creation completed and ready to use + +**Activation-related statuses:** +- **Activating**: Image is being activated +- **Activated**: Image is activated and running +- **Deactivating**: Image is being deactivated +- **Activate Failed**: Image activation failed +- **Ceased Billing**: Image has stopped billing + +## FAQ + +### Q: How to view command help? + +A: Add `--help` or `-h` parameter after any command: + +```bash +agb --help +agb image --help +agb image create --help +``` + +### Q: What to do if login fails? + +A: Please check: +1. Network connection is normal +2. Browser can access agb.cloud normally +3. You have a valid Google account +4. Firewall is not blocking the callback port + +### Q: What to do if image creation fails? + +A: Please check: +1. Dockerfile syntax is correct +2. Base image ID is valid +3. Network connection is stable +4. Check the Request ID in error messages for technical support + +### Q: How to view detailed execution information? + +A: Use `--verbose` or `-v` parameter: + +```bash +agb -v image create myImage -f ./Dockerfile -i agb-code-space-1 +``` + +### Q: What to do if image activation is slow? + +A: Image activation may take several minutes, especially when: +- First time activating a specific image +- Image is large +- System load is high + +Please be patient, the system will automatically monitor activation status. + +### Q: How to get base image IDs? + +A: Use the image list command to view system images: + +```bash +agb image list --type System +``` + +--- + +**Technical Support**: If you encounter issues, please contact the technical support team and provide relevant Request ID and Trace ID. \ No newline at end of file diff --git a/scripts/README.md b/scripts/README.md index 1228378..5448b14 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -39,7 +39,7 @@ agb login 2. **System response**: ``` [SEC] Starting AgbCloud authentication... - [SIGNAL] Using callback port: 8080 + [SIGNAL] Default callback port: 8080 [WEB] Requesting OAuth login URL... [OK] Successfully retrieved OAuth URL! [DOC] Request ID: req-xxxxx @@ -395,4 +395,4 @@ agb image list --type System --- -**Technical Support**: If you encounter issues, please contact the technical support team and provide relevant Request ID and Trace ID. \ No newline at end of file +**Technical Support**: If you encounter issues, please contact the technical support team and provide relevant Request ID and Trace ID. \ No newline at end of file From 4bdc01ab43ba6b029116ee77b4ee50c9280259b0 Mon Sep 17 00:00:00 2001 From: litiantain Date: Fri, 17 Oct 2025 16:01:20 +0800 Subject: [PATCH 4/4] refactor: remove unused index.html and update README.md scope --- .github/workflows/homebrew.yml | 5 - scripts/README.md | 484 +++++++++++---------------------- scripts/index.html | 172 ------------ 3 files changed, 163 insertions(+), 498 deletions(-) delete mode 100644 scripts/index.html diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.yml index 3caaf97..8e219bf 100644 --- a/.github/workflows/homebrew.yml +++ b/.github/workflows/homebrew.yml @@ -560,11 +560,6 @@ jobs: exit 1 fi - if [ ! -f "scripts/index.html" ]; then - echo "โŒ scripts/index.html file not found!" - exit 1 - fi - echo "โœ… All required files found" - name: Upload artifact diff --git a/scripts/README.md b/scripts/README.md index 5448b14..00f8fc6 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,398 +1,240 @@ -# AgbCloud CLI User Guide +# AgbCloud CLI Windows Installation Guide -This guide will walk you through how to use the AgbCloud CLI tool for image management operations. +This guide provides instructions for installing AgbCloud CLI on Windows using PowerShell. ## Table of Contents - [Prerequisites](#prerequisites) -- [1. Login Authentication](#1-login-authentication) -- [2. Create Image](#2-create-image) -- [3. Activate Image](#3-activate-image) -- [4. Deactivate Image](#4-deactivate-image) -- [5. List Images](#5-list-images) -- [FAQ](#faq) +- [Installation](#installation) +- [Verification](#verification) +- [Usage](#usage) +- [Troubleshooting](#troubleshooting) +- [Uninstallation](#uninstallation) ## Prerequisites -Before getting started, please ensure: -- AgbCloud CLI tool is installed -- You have a valid AgbCloud account -- Network connection is available +Before installing AgbCloud CLI, please ensure: +- Windows 10 or later (Windows Server 2016 or later) +- PowerShell 5.1 or later (PowerShell 7+ recommended) +- Internet connection +- Administrator privileges (recommended for PATH configuration) -## 1. Login Authentication +## Installation -Before using any image management features, you need to log in to AgbCloud. +### Quick Installation -### Command Syntax +Install AgbCloud CLI with a single PowerShell command: -```bash -agb login +```powershell +powershell -Command "irm https://litiantian123-code.github.io/agbcloud-cli/windows | iex" ``` -### Usage Steps - -1. **Execute login command**: - ```bash - agb login - ``` - -2. **System response**: - ``` - [SEC] Starting AgbCloud authentication... - [SIGNAL] Default callback port: 8080 - [WEB] Requesting OAuth login URL... - [OK] Successfully retrieved OAuth URL! - [DOC] Request ID: req-xxxxx - [SEARCH] Trace ID: trace-xxxxx - - [>>] Starting local callback server on port 8080... - [LINK] OAuth URL: - https://agb.cloud/oauth/authorize?... - - [WEB] Opening the browser for authentication... - ``` - -3. **Browser authentication**: - - CLI will automatically open the browser - - If the browser doesn't open automatically, manually copy the URL to your browser - - Complete Google account authentication in the browser - -4. **Authentication successful**: - ``` - [OK] Authentication successful! - [KEY] Received authorization code: abcd1234... - [REFRESH] Exchanging authorization code for access token... - [OK] Login successful! - ``` - -### Notes - -- Login session has a certain validity period, re-login is required after expiration -- Login information is securely stored in local configuration files +### Installation Process -## 2. Create Image +The installation script will: +1. **Detect system architecture** (amd64/arm64) +2. **Download the latest version** from GitHub Releases +3. **Create installation directory** (`%LOCALAPPDATA%\agbcloud` by default) +4. **Install the binary** as `agb.exe` +5. **Update PATH environment variable** (user-level) +6. **Verify installation** automatically -Creating custom images requires providing a Dockerfile and base image ID. +## Verification -### Command Syntax +After installation, verify that AgbCloud CLI is installed correctly: -```bash -agb image create --dockerfile --imageId +### Step 1: Restart PowerShell +```powershell +# Close current PowerShell window and open a new one +Start-Process powershell -Verb RunAs; exit +# Or refresh the environment variables +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") ``` -### Parameter Description - -- ``: Custom image name (required) -- `--dockerfile, -f`: Dockerfile file path (required) -- `--imageId, -i`: Base image ID (required) - -### Usage Examples - -```bash -# Full command -agb image create myCustomImage --dockerfile ./Dockerfile --imageId agb-code-space-1 - -# Using short parameters -agb image create myCustomImage -f ./Dockerfile -i agb-code-space-1 +### Step 2: Check Installation +```powershell +# Check if agb command is available +agb --version ``` -### Execution Flow - -1. **Start creation**: - ``` - [BUILD] Creating image 'myCustomImage'... - [SIGNAL] Getting upload credentials... - [OK] Upload credentials obtained (Task ID: task-xxxxx) - ``` - -2. **Upload Dockerfile**: - ``` - [UPLOAD] Uploading Dockerfile... - [OK] Dockerfile uploaded successfully - ``` - -3. **Create image**: - ``` - [WORK] Creating image... - [OK] Image creation initiated - ``` - -4. **Monitor progress**: - ``` - [MONITOR] Monitoring image creation progress... - [DATA] Status: Creating - [DATA] Status: Available - [OK] Image creation completed successfully! - ``` - -### Image Status Description - -- **Creating**: Image is being created -- **Create Failed**: Image creation failed -- **Available**: Image creation completed and ready to use - -## 3. Activate Image - -Activating an image starts a running instance. You can specify CPU and memory resources. - -### Command Syntax - -```bash -agb image activate [--cpu ] [--memory ] +**Expected Output:** +``` +AgbCloud CLI version 1.0.0 +Git commit: abc1234 +Build date: 2025-01-15T10:30:00Z ``` -### Parameter Description - -- ``: Image ID to activate (required) -- `--cpu, -c`: CPU cores (optional, must be used together with memory parameter) -- `--memory, -m`: Memory size in GB (optional, must be used together with CPU parameter) - -**Supported CPU/Memory combinations:** -- `2c4g`: 2 CPU cores + 4 GB memory -- `4c8g`: 4 CPU cores + 8 GB memory -- `8c16g`: 8 CPU cores + 16 GB memory - -**Note:** If CPU and memory parameters are not specified, default resource configuration will be used. If specified, both CPU and memory must be provided and must be one of the supported combinations above. - -### Usage Examples +### Step 3: Verify Command Help +```powershell +# Display help information +agb --help +``` -```bash -# Basic activation (using default resources) -agb image activate img-7a8b9c1d0e +**Expected Output:** +``` +Command line interface for AgbCloud services -# Using 2c4g configuration -agb image activate img-7a8b9c1d0e --cpu 2 --memory 4 +Usage: + agb [command] -# Using 4c8g configuration -agb image activate img-7a8b9c1d0e --cpu 4 --memory 8 +Available Commands: + image Manage images + login Log in to AgbCloud + logout Log out from AgbCloud + version Show version information + help Help about any command -# Using 8c16g configuration -agb image activate img-7a8b9c1d0e --cpu 8 --memory 16 +Flags: + -h, --help help for agb + -v, --verbose Enable verbose output -# Using short parameters -agb image activate img-7a8b9c1d0e -c 4 -m 8 +Use "agb [command] --help" for more information about a command. ``` -### Execution Flow - -1. **Start activation**: - ``` - [>>] Activating image 'img-7a8b9c1d0e'... - [SAVE] CPU: 4 cores, Memory: 8 GB - [SEARCH] Checking current image status... - ``` - -2. **Status check**: - ``` - [DATA] Current Status: Available - [OK] Image is available, proceeding with activation... - [REFRESH] Starting image activation... - ``` +### Step 4: Test Core Functionality +```powershell +# Test image command +agb image --help -3. **Activation successful**: - ``` - [OK] Image activation initiated successfully! - [DATA] Operation Status: true - [SEARCH] Request ID: req-xxxxx - ``` +# Test version command +agb version +``` -4. **Monitor activation status**: - ``` - [MONITOR] Monitoring image activation status... - [DATA] Status: Activating - [DATA] Status: Activated - [OK] Image activation completed successfully! - ``` +## Usage -### Image Activation Status Description +### Basic Commands -- **Available**: Image is available but not activated -- **Activating**: Image is being activated -- **Activated**: Image is activated and running -- **Activate Failed**: Image activation failed -- **Ceased Billing**: Image has stopped billing +```powershell +# Show help +agb --help -### Special Case Handling +# Show version +agb version -- If the image is already activated, the system will display the current status -- If the image is being activated, it will automatically join the monitoring process -- If the image is in a failed state, it will attempt to reactivate -- **If an invalid CPU/memory combination is specified, the system will show an error and display supported combinations** +# Login to AgbCloud +agb login -### Error Examples +# List available images +agb image list -```bash -# Invalid combination example -agb image activate img-7a8b9c1d0e --cpu 3 --memory 6 +# Create a custom image +agb image create myImage --dockerfile ./Dockerfile --imageId agb-code-space-1 -# Error output -[ERROR] Invalid CPU/Memory combination: 3c6g +# Activate an image +agb image activate img-7a8b9c1d0e -[TOOL] Supported combinations: - โ€ข 2c4g: --cpu 2 --memory 4 - โ€ข 4c8g: --cpu 4 --memory 8 - โ€ข 8c16g: --cpu 8 --memory 16 +# Deactivate an image +agb image deactivate img-7a8b9c1d0e ``` -## 4. Deactivate Image - -Deactivate (stop) a running image instance. - -### Command Syntax - -```bash -agb image deactivate +### Enable Verbose Output +```powershell +# Use -v flag for detailed output +agb -v image list +agb --verbose login ``` -### Parameter Description +## Troubleshooting -- ``: Image ID to deactivate (required) +### Common Issues -### Usage Examples - -```bash -agb image deactivate img-7a8b9c1d0e +#### Issue 1: Command Not Found +```powershell +# Error: 'agb' is not recognized as an internal or external command ``` -### Execution Flow - -1. **Start deactivation**: - ``` - ๐Ÿ›‘ Deactivating image 'img-7a8b9c1d0e'... - [REFRESH] Deactivating image instance... +**Solutions:** +1. **Restart PowerShell** or refresh environment variables: + ```powershell + $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") ``` -2. **Deactivation successful**: - ``` - [OK] Image deactivation initiated successfully! - [DATA] Operation Status: true - [SEARCH] Request ID: req-xxxxx +2. **Check installation directory:** + ```powershell + Get-ChildItem "$env:LOCALAPPDATA\agbcloud" ``` -### Notes - -- Deactivating an image will terminate the running instance -- The image status will change to "Available" after deactivation -- Deactivation operation usually takes effect immediately - -## 5. List Images - -View your image list with pagination and type filtering support. - -### Command Syntax - -```bash -agb image list [--type ] [--page ] [--size ] -``` - -### Parameter Description - -- `--type, -t`: Image type, options: - - `User`: User custom images (default) - - `System`: System-provided base images -- `--page, -p`: Page number, default is 1 -- `--size, -s`: Items per page, default is 10 - -### Usage Examples - -```bash -# View user images (default) -agb image list - -# View system images -agb image list --type System - -# Paginated view -agb image list --page 2 --size 5 - -# Using short parameters -agb image list -t User -p 1 -s 20 +#### Issue 2: Installation Failed +```powershell +# Error: Failed to download AgbCloud CLI ``` -### Output Example +**Solutions:** +1. **Check internet connection** +2. **Try running the installation command again** +3. **Use manual download from GitHub Releases if needed** -``` -[DOC] Listing User images (Page 1, Size 10)... -[SEARCH] Fetching image list... -[OK] Found 3 images (Total: 3) -[PAGE] Page 1 of 1 (Page Size: 10) - -IMAGE ID IMAGE NAME STATUS TYPE UPDATED AT --------- ---------- ------ ---- ---------- -img-7a8b9c1d0e myCustomImage Available User 2025-01-15 10:30 -img-2f3g4h5i6j webAppImage Activated User 2025-01-15 09:15 -img-8k9l0m1n2o dataProcessImage Creating User 2025-01-15 11:45 +#### Issue 3: Permission Denied +```powershell +# Error: Access denied or execution policy restriction ``` -### Status Description +**Solutions:** +1. **Run as Administrator:** + ```powershell + # Right-click PowerShell and select "Run as Administrator" + ``` -Images can be in the following states: +2. **Check execution policy:** + ```powershell + Get-ExecutionPolicy + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + ``` -**Creation-related statuses:** -- **Creating**: Image is being created -- **Create Failed**: Image creation failed -- **Available**: Image creation completed and ready to use -**Activation-related statuses:** -- **Activating**: Image is being activated -- **Activated**: Image is activated and running -- **Deactivating**: Image is being deactivated -- **Activate Failed**: Image activation failed -- **Ceased Billing**: Image has stopped billing +### Getting Help -## FAQ +If you encounter issues: +1. **Check the installation log** for error messages +2. **Verify system requirements** (Windows version, PowerShell version) +3. **Try manual installation** from GitHub Releases +4. **Contact support** with error details and system information -### Q: How to view command help? +## Uninstallation -A: Add `--help` or `-h` parameter after any command: +To remove AgbCloud CLI: -```bash -agb --help -agb image --help -agb image create --help +### Step 1: Remove Binary +```powershell +# Remove installation directory +Remove-Item -Path "$env:LOCALAPPDATA\agbcloud" -Recurse -Force ``` -### Q: What to do if login fails? - -A: Please check: -1. Network connection is normal -2. Browser can access agb.cloud normally -3. You have a valid Google account -4. Firewall is not blocking the callback port - -### Q: What to do if image creation fails? - -A: Please check: -1. Dockerfile syntax is correct -2. Base image ID is valid -3. Network connection is stable -4. Check the Request ID in error messages for technical support - -### Q: How to view detailed execution information? - -A: Use `--verbose` or `-v` parameter: - -```bash -agb -v image create myImage -f ./Dockerfile -i agb-code-space-1 +### Step 2: Clean PATH +```powershell +# Remove from user PATH +$agbPath = "$env:LOCALAPPDATA\agbcloud" +$currentPath = [Environment]::GetEnvironmentVariable("Path", "User") +$newPath = ($currentPath.Split(';') | Where-Object { $_ -ne $agbPath }) -join ';' +[Environment]::SetEnvironmentVariable("Path", $newPath, "User") ``` -### Q: What to do if image activation is slow? +### Step 3: Verify Removal +```powershell +# This should return an error +agb --version +``` -A: Image activation may take several minutes, especially when: -- First time activating a specific image -- Image is large -- System load is high +--- -Please be patient, the system will automatically monitor activation status. +## Additional Information -### Q: How to get base image IDs? +### System Requirements +- **OS**: Windows 10/11, Windows Server 2016+ +- **Architecture**: x64 (amd64) or ARM64 +- **PowerShell**: 5.1+ (7+ recommended) +- **Disk Space**: ~50MB +- **Network**: Internet connection for download -A: Use the image list command to view system images: +### Installation Locations +- **Default**: `%LOCALAPPDATA%\agbcloud\agb.exe` -```bash -agb image list --type System -``` +### Links +- **GitHub Repository**: https://github.com/agbcloud/agbcloud-cli +- **Releases**: https://github.com/agbcloud/agbcloud-cli/releases +- **Documentation**: https://github.com/agbcloud/agbcloud-cli/blob/main/docs/USER_GUIDE.md +- **Issues**: https://github.com/agbcloud/agbcloud-cli/issues --- -**Technical Support**: If you encounter issues, please contact the technical support team and provide relevant Request ID and Trace ID. \ No newline at end of file +**Note**: This installation method downloads the latest stable release. For development versions or specific releases, please visit the GitHub Releases page. \ No newline at end of file diff --git a/scripts/index.html b/scripts/index.html deleted file mode 100644 index e2dfc2c..0000000 --- a/scripts/index.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - AgbCloud CLI - Installation - - - -
- -
Command Line Interface for AgbCloud Platform
-
- -
-

๐Ÿš€ Quick Installation

-

Install AgbCloud CLI with a single command:

- -

Windows (PowerShell)

-
powershell -Command "irm https://agbcloud.github.io/agbcloud-cli/windows | iex"
- - -

Alternative Installation Methods

-

You can also download binaries directly from our GitHub Releases page.

-
- -
-
-

๐Ÿ”ง Easy Installation

-

One-command installation with automatic PATH configuration and architecture detection.

-
-
-

๐Ÿ”„ Auto Updates

-

Built-in version checking and upgrade capabilities to keep your CLI up-to-date.

-
-
-

๐Ÿ—๏ธ Cross Platform

-

Supports Windows (amd64/arm64) with plans for macOS and Linux support.

-
-
-

๐Ÿ›ก๏ธ Secure

-

Downloads from official GitHub releases with integrity verification.

-
-
- -
-

๐Ÿ“– Quick Start

-

After installation, get started with these commands:

-
-# Show help -agb --help - -# Show version -agb version - -# Login to AgbCloud -agb login - -# List available images -agb image list -
-
- - - - - - \ No newline at end of file