Skip to content

fix: unbreak the CLI on Windows and make create scriptable - #9

Merged
martian56 merged 2 commits into
mainfrom
fix/windows-help-crash-and-noninteractive-create
Aug 4, 2026
Merged

fix: unbreak the CLI on Windows and make create scriptable#9
martian56 merged 2 commits into
mainfrom
fix/windows-help-crash-and-noninteractive-create

Conversation

@martian56

@martian56 martian56 commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Found while exercising the CLI end to end against production (create + deploy for static, PHP+database, and build projects). All three site types deploy correctly; these are the defects hit along the way.

1. Every command crashed on Windows

The UI prints emoji and box-drawing characters, but the Windows console defaults to cp1252, which cannot encode them:

$ ufazien --help
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f680'

--help never printed at all. Fixed by reconfiguring stdout/stderr to UTF-8 with errors="replace", so unencodable output degrades instead of aborting. Python only — Node does not have this failure mode.

2. create hung forever without a terminal

It prompted for a description and for "Create project structure?" unconditionally, even when every flag was supplied, so any scripted or CI use blocked on a read that never returned.

Prompts are now skipped when stdin is not a TTY or --yes is passed. New flags supply what the prompts used to: --description, --build-folder, --yes. Values that cannot be defaulted fail fast naming the flag to pass, instead of hanging.

3. Aborting create orphaned the website

.ufazien.json was written at the very end, after the scaffolding prompts — but the website and its database were created well before them. Answering "no", pressing Ctrl-C, or any error in between left both existing server-side with nothing local recording their ids: deploy could not find the site, and re-running create silently provisioned a duplicate.

I hit this on the first run and had to reconstruct .ufazien.json by hand. The config is now saved as soon as the remote resources exist.

Also: --no-structure

Scaffolding overwrites files like index.html. Fine when a human confirms it, destructive in a scripted run against an existing project.

Verification

  • ufazien --help on Windows without any encoding workaround ✅
  • Scripted create --yes + deploy with no TTY, end to end, site live ✅
  • --no-structure leaves an existing index.html untouched ✅
  • create with no name and no TTY fails immediately with guidance, rather than hanging ✅
  • tsc --noEmit clean; both packages build (npm run build, python -m build) ✅

Note on releasing

No version bump here, since publishing is triggered by pushing a v* tag (which creates the Release that the PyPI/npm workflows listen for), not by merging to main. Bump and tag when you want 0.3.2 out.

Summary by CodeRabbit

  • New Features
    • Added noninteractive project creation with --yes and automatic non-TTY support.
    • Added options for project descriptions, build folders, and skipping project scaffolding.
    • Added defaults for website type and PHP database creation.
    • Added required validation for name and subdomain in noninteractive mode.
  • Improvements
    • Added confirmation safeguards before overwriting existing configuration.
    • Configuration is now saved immediately after remote resources are created.
    • Improved UTF-8 handling for command-line output.

Three bugs found while exercising the CLI end to end against production.

1. Every command crashed on Windows.

   The UI prints emoji and box-drawing characters, but the Windows
   console defaults to cp1252, which cannot encode them. `ufazien --help`
   died with UnicodeEncodeError before printing anything, and so did any
   other command that reached the banner. stdout/stderr are now
   reconfigured to UTF-8 with errors="replace", so unencodable output
   degrades instead of aborting.

2. `create` hung forever when not attached to a terminal.

   It prompted for a description and for "Create project structure?"
   unconditionally, even when every flag was supplied, so scripted and CI
   use blocked on a read that never returned. Prompts are now skipped
   when stdin is not a TTY or --yes is passed, and the missing pieces are
   supplied by new --description, --build-folder and --yes flags.
   Required values that cannot be defaulted fail fast with a message
   naming the flag to pass.

3. Aborting `create` orphaned the website.

   .ufazien.json was written at the very end, after the scaffolding
   prompts, while the website and its database were created well before
   them. Answering "no", pressing Ctrl-C, or any error in between left
   the resources existing server-side with nothing local recording their
   ids: `deploy` could not find the site, and re-running `create`
   silently provisioned a duplicate. The config is now saved as soon as
   the remote resources exist.

Also adds --no-structure. Scaffolding overwrites files like index.html,
which is fine when a human confirms it but destructive in a scripted run
against an existing project.

Both packages are affected identically and are fixed in parallel; the
encoding fix is Python-only since Node does not have that failure mode.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@martian56, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fe77832e-a084-4174-806f-2fb157b9b715

📥 Commits

Reviewing files that changed from the base of the PR and between e5745d6 and d6d073b.

📒 Files selected for processing (2)
  • ufazien-cli-js/src/cli.ts
  • ufazien-cli-py/src/ufazien/cli.py
📝 Walkthrough

Walkthrough

The JavaScript and Python create commands now support noninteractive execution, additional options, required-input validation, defaults, early configuration persistence, and optional project scaffolding.

Changes

Create workflow

Layer / File(s) Summary
Command inputs and noninteractive defaults
ufazien-cli-js/src/cli.ts, ufazien-cli-py/src/ufazien/cli.py
The commands add description, build-folder, confirmation, and scaffolding options. Noninteractive execution validates name and subdomain, applies website, database, build-folder, and description defaults, and configures UTF-8 output in Python.
Provisioning and configuration persistence
ufazien-cli-js/src/cli.ts, ufazien-cli-py/src/ufazien/cli.py
The commands save configuration after remote website and database provisioning. Project structure creation follows --no-structure and noninteractive defaults. Duplicate final saves were removed.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the Windows CLI fix and the addition of scriptable, noninteractive create behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/windows-help-crash-and-noninteractive-create

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@martian56 martian56 self-assigned this Aug 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ufazien-cli-py/src/ufazien/cli.py`:
- Around line 130-131: Resolve the Ruff FA100 diagnostics in the CLI option
declarations by making Optional available before the annotations in the module,
either by adding the typing import or enabling postponed annotations with the
future directive. Keep the existing description and build_folder_opt annotations
unchanged.
- Around line 311-328: Update the create flow to persist configuration
immediately after create_website returns, including the website ID, then update
and save database_id as soon as create_database completes and before readiness
polling begins. Ensure the existing later save does not remain the sole
persistence point, while preserving the current configuration fields and
build_folder handling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c65f6433-225f-4c27-803f-cf33b723498a

📥 Commits

Reviewing files that changed from the base of the PR and between 00dedd7 and e5745d6.

📒 Files selected for processing (2)
  • ufazien-cli-js/src/cli.ts
  • ufazien-cli-py/src/ufazien/cli.py

Comment thread ufazien-cli-py/src/ufazien/cli.py
Comment thread ufazien-cli-py/src/ufazien/cli.py Outdated
@martian56
martian56 merged commit 91d8015 into main Aug 4, 2026
3 of 4 checks passed
@martian56
martian56 deleted the fix/windows-help-crash-and-noninteractive-create branch August 4, 2026 19:47
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