Files
Francesco Bonacci 174ae253ba feat: auto-generated SDK docs, Python CLI, and docs improvements (#1040)
* feat: auto-generated SDK docs, Python CLI, and docs improvements

- Add auto-generated SDK reference pages (computer-sdk, agent-sdk) with version selector
- Add Python CLI package (cua-cli) with auth, sandbox, image, MCP commands
- Deprecate TypeScript CLI in favor of Python CLI
- Add versioned docs (agent-sdk v0.3-v0.7, computer-sdk v0.3-v0.5)
- Rename cloud-cli to cli in docs
- Add mobile header fix with sidebar toggle
- Restructure guide pages (quickstart, self-hosted-sandboxes)
- Add redirects for old /api URLs
- Update workflows, lume docs, cuabench docs, desktop sandbox docs

* refactor: auto-generate CLI index page like computer/agent SDKs

Change CLI docs to use the same auto-generated index.mdx pattern as
computer-sdk and agent-sdk. Removes hand-written index page that could
become stale, and deletes the separate api.mdx.

* fix: rename "Cua Bench API Reference" to "API Reference" in menu

* fix: update lume examples to macos-tahoe-vanilla and shorten page titles

- Replace macos-sequoia-vanilla:latest with macos-tahoe-vanilla:latest
  in lume docs and generator
- Rename "Lume CLI Reference" to "CLI Reference"
- Rename "Lume HTTP API Reference" to "API Reference"

* feat: rename CuaBot to Cua-Bot and add to dropdown selector

- Rename CuaBot to Cua-Bot in docs meta.json and content pages
- Add Cua-Bot entry to the header dropdown selector

* refactor: restructure Cua-Bot docs to match Cua/Cua-Bench pattern

Reorganize cuabot docs from flat structure into guide/getting-started/
hierarchy matching other collections:
- cuabot.mdx → guide/getting-started/introduction.mdx
- install.mdx → guide/getting-started/installation.mdx
- Add meta.json files with proper icons and structure
- Update dropdown selector href to new path

* feat(docs): add auto-generated API reference, changelog, and versioning for Cua-Bot

Add TypeScript SDK doc generator (regex-based, no compiler dependency) and
configure cuabot for changelog generation and versioned docs snapshots.

* feat(ci): add cuabot to docs drift check and improve failure message

Wire cuabot into CI path triggers, runner config, and changed-file
detection. Add --check mode to typescript-sdk.ts for drift comparison.
Update failure banner with per-library and versioning commands.

* fix: resolve Python lint issues (black, ruff)

Run black formatting on 12 files, fix ruff F841 (unused variables) in
tests, and add TYPE_CHECKING import for FastMCP forward references.

* fix: resolve TS typecheck and Lume Swift 6 CI failures

- typescript-typecheck.js: build @trycua/core before running typecheck
  so its dist/ type declarations are available for @trycua/computer
- SSHClient.swift: avoid crossing Sendable boundary with NIOSSHHandler
  by keeping handler access + createChannel within flatMap on the event
  loop, fixing Swift 6 strict concurrency errors

* fix: TS typecheck pnpm version strict mode and Lume mock conformance

- Set COREPACK_ENABLE_STRICT=0 in typecheck script to allow pnpm 9.x
  to run commands in workspace packages declaring pnpm 10.x
- Update MockVNCService.sendText signature to match protocol (add
  delayMs parameter)

* fix: run prettier formatting and ignore auto-generated docs files

Format all files to pass prettier 3.8.1 check. Add docs/.source/ and
docs/next-env.d.ts to .prettierignore (auto-generated, not editable).

* fix: restore MDX comment syntax broken by prettier

Prettier 3.8.1 converts {/* */} to {/_ _/} in MDX files, which breaks
the acorn parser. Restore all comments and add *.mdx to .prettierignore.

* fix: regenerate docs to pass drift check after prettier revert

* fix: CI docs check fetch-depth, regenerate Lume docs, fix header layout shift

- Use fetch-depth: 0 in CI checkout so git tags are available for
  version discovery (was using fetch-depth: 2, causing version fallback)
- Regenerate Lume docs from local Swift build (0.2.75 → 0.2.76)
- Fix header product selector layout shift with consistent icon/text sizing

* fix: format custom-header.tsx with prettier

* fix: use arch-agnostic JAVA_HOME for arm64 Docker build

The openjdk package writes the arch-specific path (e.g. java-17-openjdk-amd64)
to /etc/environment, which sdkmanager sources, overriding the Dockerfile ENV.
Create an arch-agnostic symlink and re-export JAVA_HOME in the sdkmanager RUN
step to ensure it works on both amd64 and arm64.

* fix: skip emulator package on arm64 (not available for that arch)

The Android emulator SDK package is only published for amd64.
Conditionally install it based on dpkg --print-architecture.

* ci: retrigger cuabot docker build
2026-02-09 08:54:11 +01:00

185 lines
6.9 KiB
YAML

name: "CD: cua-agent (PyPI)"
on:
push:
tags:
- "agent-v*"
workflow_dispatch:
inputs:
version:
description: "Version to publish (without v prefix)"
required: true
default: "0.1.0"
workflow_call:
inputs:
version:
description: "Version to publish"
required: true
type: string
# Adding permissions at workflow level
permissions:
contents: write
jobs:
prepare:
runs-on: macos-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
computer_version: ${{ steps.update-deps.outputs.computer_version }}
som_version: ${{ steps.update-deps.outputs.som_version }}
core_version: ${{ steps.update-deps.outputs.core_version }}
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Ensure latest main branch
run: |
git fetch origin main
git reset --hard origin/main
echo "Current HEAD commit:"
git log -1 --oneline
- name: Determine version
id: get-version
run: |
# Check inputs.version first (works for workflow_call regardless of event_name)
if [ -n "${{ inputs.version }}" ]; then
VERSION=${{ inputs.version }}
elif [ "${{ github.event_name }}" == "push" ]; then
# Extract version from tag (for package-specific tags)
if [[ "${{ github.ref }}" =~ ^refs/tags/agent-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "ERROR: Invalid tag format for agent"
exit 1
fi
elif [ -n "${{ github.event.inputs.version }}" ]; then
VERSION=${{ github.event.inputs.version }}
else
echo "ERROR: No version found (inputs.version, event.inputs.version, and tag all empty)"
exit 1
fi
echo "Agent version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Update dependencies to latest versions
id: update-deps
run: |
cd libs/python/agent
# Install required package for PyPI API access
pip install requests
# Create a more robust Python script for PyPI version checking
cat > get_latest_versions.py << 'EOF'
import requests
import json
import sys
def get_package_version(package_name, fallback="0.1.0"):
try:
response = requests.get(f'https://pypi.org/pypi/{package_name}/json')
print(f"API Response Status for {package_name}: {response.status_code}", file=sys.stderr)
if response.status_code != 200:
print(f"API request failed for {package_name}, using fallback version", file=sys.stderr)
return fallback
data = json.loads(response.text)
if 'info' not in data:
print(f"Missing 'info' key in API response for {package_name}, using fallback version", file=sys.stderr)
return fallback
return data['info']['version']
except Exception as e:
print(f"Error fetching version for {package_name}: {str(e)}", file=sys.stderr)
return fallback
# Get latest versions
print(get_package_version('cua-computer'))
print(get_package_version('cua-som'))
print(get_package_version('cua-core'))
EOF
# Execute the script to get the versions
VERSIONS=($(python get_latest_versions.py))
LATEST_COMPUTER=${VERSIONS[0]}
LATEST_SOM=${VERSIONS[1]}
LATEST_CORE=${VERSIONS[2]}
echo "Latest cua-computer version: $LATEST_COMPUTER"
echo "Latest cua-som version: $LATEST_SOM"
echo "Latest cua-core version: $LATEST_CORE"
# Output the versions for the next job
echo "computer_version=$LATEST_COMPUTER" >> $GITHUB_OUTPUT
echo "som_version=$LATEST_SOM" >> $GITHUB_OUTPUT
echo "core_version=$LATEST_CORE" >> $GITHUB_OUTPUT
# Determine major version for version constraint
COMPUTER_MAJOR=$(echo $LATEST_COMPUTER | cut -d. -f1)
SOM_MAJOR=$(echo $LATEST_SOM | cut -d. -f1)
CORE_MAJOR=$(echo $LATEST_CORE | cut -d. -f1)
NEXT_COMPUTER_MAJOR=$((COMPUTER_MAJOR + 1))
NEXT_SOM_MAJOR=$((SOM_MAJOR + 1))
NEXT_CORE_MAJOR=$((CORE_MAJOR + 1))
# Update dependencies in pyproject.toml
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS version of sed needs an empty string for -i
sed -i '' "s/\"cua-computer>=.*,<.*\"/\"cua-computer>=$LATEST_COMPUTER,<$NEXT_COMPUTER_MAJOR.0.0\"/" pyproject.toml
sed -i '' "s/\"cua-som>=.*,<.*\"/\"cua-som>=$LATEST_SOM,<$NEXT_SOM_MAJOR.0.0\"/" pyproject.toml
sed -i '' "s/\"cua-core>=.*,<.*\"/\"cua-core>=$LATEST_CORE,<$NEXT_CORE_MAJOR.0.0\"/" pyproject.toml
else
# Linux version
sed -i "s/\"cua-computer>=.*,<.*\"/\"cua-computer>=$LATEST_COMPUTER,<$NEXT_COMPUTER_MAJOR.0.0\"/" pyproject.toml
sed -i "s/\"cua-som>=.*,<.*\"/\"cua-som>=$LATEST_SOM,<$NEXT_SOM_MAJOR.0.0\"/" pyproject.toml
sed -i "s/\"cua-core>=.*,<.*\"/\"cua-core>=$LATEST_CORE,<$NEXT_CORE_MAJOR.0.0\"/" pyproject.toml
fi
# Display the updated dependencies
echo "Updated dependencies in pyproject.toml:"
grep -E "cua-computer|cua-som|cua-core" pyproject.toml
publish:
needs: prepare
uses: ./.github/workflows/py-reusable-publish.yml
with:
package_name: "agent"
package_dir: "libs/python/agent"
version: ${{ needs.prepare.outputs.version }}
base_package_name: "cua-agent"
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
set-env-variables:
needs: [prepare, publish]
runs-on: macos-latest
steps:
- name: Set environment variables for use in other jobs
run: |
echo "COMPUTER_VERSION=${{ needs.prepare.outputs.computer_version }}" >> $GITHUB_ENV
echo "SOM_VERSION=${{ needs.prepare.outputs.som_version }}" >> $GITHUB_ENV
echo "CORE_VERSION=${{ needs.prepare.outputs.core_version }}" >> $GITHUB_ENV
create-release:
needs: [prepare, publish]
uses: ./.github/workflows/release-github-reusable.yml
with:
tag_name: "agent-v${{ needs.prepare.outputs.version }}"
release_name: "cua-agent v${{ needs.prepare.outputs.version }}"
module_path: "libs/python/agent"
body: |
**Dependencies:** cua-computer ${{ needs.prepare.outputs.computer_version }}, cua-som ${{ needs.prepare.outputs.som_version }}