feat(cli): add phala instance-types command and other improvements#161
feat(cli): add phala instance-types command and other improvements#161
Conversation
getSerialLogEndpoint hardcoded an app_ prefix when constructing the API path, which broke name-based CVM identifiers (e.g. "my-cvm"). Use the already-normalized appId directly, consistent with getContainerLogEndpoint and other cvms subcommands.
The catch block in logs-handler previously swallowed the real error (e.g. 404 from syslog server) when public_logs was false, showing only the misleading "Logs are disabled" message. Now the actual failure reason is displayed first, followed by the public_logs hint.
Calls the composition API via the JS SDK and displays container name, image, creation time, status and state in a plain table.
Add two new workspace-level API endpoints: - getWorkspaceNodes: List nodes accessible by workspace - getWorkspaceQuotas: Get tier-based resource quotas Both APIs follow the existing SDK patterns with proper TypeScript typing, schema validation, and safe variants.
Remove verbose and redundant phrasing from all CLI command help text. Key changes: - Remove [DEPRECATED] prefix from deprecated options (redundant) - Simplify command descriptions: - "Manage Phala Confidential Virtual Machines (CVMs)" → "Manage CVMs" - "List apps (current CVM status)" → "List dstack apps" - "Check Phala Cloud status and authentication" → "Check authentication status" - Simplify option descriptions: - "Number of lines to show from the end of the logs" → "Lines from end" - "Follow log output (stream logs in real-time)" → "Stream logs in real-time" - "Allow restart of the CVM if needed for resizing" → "Allow CVM restart" - "If not provided, X" → "(auto-selected if omitted)" or "(defaults to X)" - Simplify examples: - "List apps (page 1)" → "List apps" - "Deploy new CVM with auto-selection (simplest)" → "Deploy new CVM" - "Connect to a specific CVM (queries API for gateway)" → "Connect to CVM" All changes follow anti-slop principles: remove filler words, avoid hedging language, state facts directly, use concise phrasing.
Replace safeGetAvailableNodes with safeGetWorkspaceNodes to use workspace-scoped node listing. Changes include: - Use safeGetCurrentUser to obtain workspace teamSlug - Call safeGetWorkspaceNodes with pagination support - Replace detailed multi-line output with table format - Display columns: ID, NAME, REGION, PPID, DEVICE_ID, VERSION - Show version number only (strip git info) - Add pagination info (page/total) - Support aliases: 'phala nodes', 'phala nodes list', 'phala nodes ls' Output format: ID NAME REGION PPID DEVICE_ID VERSION 1 tdxlab US-WEST-1 80d4a149124353c7 1234 v0.5.4 Page 1/1 (total 1)
Add new command to list available instance types. Supports: - List all instance type families (default) - Filter by family via positional argument (cpu, gpu) - JSON output with --json flag - Table format display with ID, name, vCPU, memory, hourly rate Command is in deploy category alongside nodes command. Usage: phala instance-types # all families phala instance-types cpu # CPU family only phala instance-types --json # JSON output
📋 Check Results✨ JS SDK - Code FormattingShow format check results🔍 JS SDK - TypeScript Type CheckShow type check output🧪 JS SDK - Test ResultsShow test output📝 JS SDK - Lint CheckShow lint results🌐 JS SDK - Browser CompatibilityShow browser test results🌐 Browser Compatibility ReportBrowser compatibility tests completed across:
The SDK has been verified to work in modern browser environments. Check run: https://github.com/Phala-Network/phala-cloud/actions/runs/21538555238 |
The nodes list command was using workspace.name instead of workspace.slug
to construct API paths, causing failures for workspaces where name differs
from slug (e.g., "My Company" vs "my-company").
Changes:
- Fix nodes list to use workspace.slug for /workspaces/{teamSlug}/nodes
- Update credentials system to store workspace slug
- Add null check for slug with helpful error message
- Update all login flows to extract and persist workspace slug
This adapts to the backend API change that introduced workspace slugs
as the canonical URL-safe identifier.
|
!release sdk minor |
|
Expected format: Examples:
|
|
!release js minor |
|
🚀 @Leechael release command accepted: Target branch: |
|
!release cli patch |
|
🚀 @Leechael release command accepted: Target branch: |
|
🎉 Release completed:
📦 Package Info
📄 Files included |
|
❌ @Leechael release failed: Branch: |
The help text format was changed to use specific group labels (Deploy, Manage, CVM operations, etc.) instead of a generic "Commands:" header. Update the test to match the current format. This test was already failing before the workspace slug fix.
|
!release cli patch |
|
🚀 @Leechael release command accepted: Target branch: |
|
🎉 Release completed:
📦 Package Info
📄 Files included |
Summary
This PR adds several new CLI commands and improves existing functionality:
ps,logs,apps,instance-typesnodesto workspace-scoped APINew Commands
phala ps- List CVM containersList all running CVM instances with status and uptime.
phala logs- View CVM logsFetch logs from running CVMs with filtering options.
phala apps- List dstack appsDisplay all dstack applications with their CVM status.
phala instance-types- List instance typesphala instance-types- List all instance type familiesphala instance-types cpu- List CPU instance typesphala instance-types gpu- List GPU instance types--jsonflag for JSON outputImprovements
Workspace API Migration
phala nodesnow uses workspace-scoped nodes APIBug Fixes
public_logsandpublic_sysinfoto true in CLI deployRefactoring
cvms lsoutput format with other list commandsSDK Changes
Added to
@phala/cloudJS SDK:getWorkspaceNodes()- List workspace nodes with paginationgetWorkspaceQuotas()- Get workspace resource quotasTest Plan