Skip to content

Improve CLI error handling for unrecognized commands#6

Merged
robdimarco-atxp merged 1 commit intomainfrom
robdimarco/atxp-254-in-cli-if-command-is-unrecognized-give-a-nice-error-message
Sep 9, 2025
Merged

Improve CLI error handling for unrecognized commands#6
robdimarco-atxp merged 1 commit intomainfrom
robdimarco/atxp-254-in-cli-if-command-is-unrecognized-give-a-nice-error-message

Conversation

@robdimarco-atxp
Copy link
Contributor

Summary

• Show full help information when user enters an unrecognized command
• Previously only displayed a brief error message requiring users to run help separately
• Improves user experience by providing immediate visibility into available commands

Test plan

  • Test with invalid command (e.g., npx atxp invalid-command) - shows error + help
  • Test with valid commands (help, demo) - work as expected
  • Test with no command - shows help as before
  • Verify build passes

🤖 Generated with Claude Code

Show full help information when user enters an unrecognized command instead
of just displaying a brief error message. This provides better UX by letting
users immediately see available commands without needing to run help separately.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@linear
Copy link

linear bot commented Sep 9, 2025

@robdimarco-atxp robdimarco-atxp merged commit ec9b09e into main Sep 9, 2025
1 check passed
@robdimarco-atxp robdimarco-atxp deleted the robdimarco/atxp-254-in-cli-if-command-is-unrecognized-give-a-nice-error-message branch September 9, 2025 21:23
robdimarco-atxp added a commit that referenced this pull request Sep 9, 2025
Implement ATXP-243: Allow users to specify separate frontend and backend ports
when running the demo, replacing the single --port option with more granular control.

## Changes Made

### Command Line Interface
- Replace `--port, -p` with `--frontend-port, --fp` and `--backend-port, --bp`
- Update default ports: frontend 3000, backend 3001 (matching atxp-express-example defaults)
- Maintain backward compatibility by using sensible defaults

### Configuration Management
- Generate .env files for both frontend and backend directories with appropriate port settings
- Backend .env: `PORT` and `FRONTEND_PORT` (for CORS configuration)
- Frontend .env: `PORT` and `REACT_APP_BACKEND_PORT` (for proxy configuration)
- Graceful fallback if .env creation fails (uses environment variables)

### Updated Documentation
- Comprehensive help text with new port options and examples
- Clear usage examples showing frontend/backend port combinations
- Updated default port information throughout

## Implementation Details

The demo command now:
1. Parses separate frontend/backend port arguments
2. Creates appropriate .env files in the cloned repository
3. Passes environment variables to the demo process
4. Uses frontend port for browser opening and user messaging

This integrates seamlessly with the atxp-express-example repository's existing
port configuration system implemented in PR #6.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
robdimarco-atxp added a commit that referenced this pull request Sep 9, 2025
…#7)

* Add separate frontend and backend port configuration for demo command

Implement ATXP-243: Allow users to specify separate frontend and backend ports
when running the demo, replacing the single --port option with more granular control.

## Changes Made

### Command Line Interface
- Replace `--port, -p` with `--frontend-port, --fp` and `--backend-port, --bp`
- Update default ports: frontend 3000, backend 3001 (matching atxp-express-example defaults)
- Maintain backward compatibility by using sensible defaults

### Updated Documentation
- Comprehensive help text with new port options and examples
- Clear usage examples showing frontend/backend port combinations
- Updated default port information throughout

## Implementation Details

The demo command now:
1. Parses separate frontend/backend port arguments
2. Creates appropriate .env files in the cloned repository
3. Passes environment variables to the demo process
4. Uses frontend port for browser opening and user messaging

This integrates seamlessly with the atxp-express-example repository's existing
port configuration system implemented in PR #6.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update default ports to maintain backward compatibility

- Frontend port: 8016 (original default, maintains backward compatibility)
- Backend port: 8017 (one number higher as requested)
- Updated help documentation with new default port values
- Verified .env file generation works correctly with new defaults

This preserves existing user expectations while providing the requested
port separation functionality.

* Fix backend port configuration issue

Remove global PORT environment variable that was overriding backend .env file.
Now each service (frontend/backend) reads its PORT from its own .env file,
allowing them to run on separate ports correctly.

Fixes issue where backend was running on frontend port instead of backend port,
causing ECONNREFUSED errors in the proxy connection.

Verified fix: Backend=8017, Frontend=8016, proxy connections working.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant