Skip to content

Conversation

@bcotrim
Copy link
Contributor

@bcotrim bcotrim commented Oct 2, 2025

Related issues

Proposed Changes

  • Make authToken.id optional in the CLI schema to support older config files
  • Add validation in getAuthToken() to ensure id exists when the token is actually used

Testing Instructions

  1. Edit your appdata-v1.json file (located at ~/Library/Application Support/Studio/appdata-v1.json on macOS)
  2. Remove the id field from the authToken object
  3. Run npm run cli:build
  4. Run node ./dist/cli/main.js in terminal - should show help without errors
  5. Try to use a preview command (e.g., node ./dist/cli/main.js preview create) - should get a clear "Authentication required" message
  6. Re-authenticate via the Studio app
  7. Preview commands should now work correctly

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@bcotrim bcotrim self-assigned this Oct 2, 2025
@bcotrim bcotrim requested a review from a team October 2, 2025 12:51
Copy link
Contributor

@ivan-ottinger ivan-ottinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good and work as expected. 👌🏼🙂

  1. Run node ./dist/cli/main.js in terminal - should show help without errors
Markup on 2025-10-02 at 15:09:23

Try to use a preview command (e.g., node ./dist/cli/main.js preview create) - should get a clear "Authentication required" message

Markup on 2025-10-02 at 15:23:16

I was just running this outside of the folder with WordPress site so I temporarily commented out these two checks:

Markup on 2025-10-02 at 15:21:47

Copy link
Contributor

@nightnei nightnei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and works well 👍
@ivan-ottinger JIC I tested inside wordpress folder and it works well:
node ~/<path_to_studio>/studio/dist/cli/main.js preview create

Screenshot 2025-10-02 at 14 23 00 Screenshot 2025-10-02 at 14 26 36 Screenshot 2025-10-02 at 14 28 15

@bcotrim bcotrim merged commit 3179b74 into trunk Oct 2, 2025
12 checks passed
@bcotrim bcotrim deleted the stu-836-studio-cli-throws-error-related-to-invalid-config-format branch October 2, 2025 14:14
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.

4 participants