Skip to content

Fix exit codes, make:model table and fillable, serve port warning, rollback production check - #10

Merged
necessarylion merged 4 commits into
mainfrom
fix/cli-small-fixes
Nov 2, 2026
Merged

necessarylion merged 4 commits into
mainfrom
fix/cli-small-fixes

Conversation

@mydoxie

@mydoxie mydoxie commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Four small CLI fixes. One commit per fix.

  1. Exit code

    • Problem: dox exited with 0 when there was no command, the command was unknown, the arguments were wrong, or the command threw. Scripts and CI could not see the failure.
    • Fix: these cases now exit with 1. New test runs the real binary.
  2. make:model

    • Problem: make:model Post wrote @DoxModel(), so the ORM used the table post. But -m makes the table posts.
    • Fix: the model always gets the same plural table, like @DoxModel(table: 'posts').
    • The stub now has an empty fillable list with a comment. A model is guarded, so create(req.body) throws MassAssignmentException until the user lists the columns. The comment says this.
  3. dox serve --port

    • Problem: dox serve --port=8080 ignored the flag with no message.
    • Fix: an unknown option prints a warning. It says to set APP_PORT in .env, or to run APP_PORT=8080 dox serve. The server still starts.
  4. Production check

    • migration:rollback now has the same production check as fresh, reset and refresh. It takes --force too.
    • dox migrate --force still works with no error. --force is not passed on to bin/migrate.dart.
    • New tests: a "no" stops before the migration runs, and --force is not passed on.

Checks: dart analyze has no issues. dart test passes (127 tests).

@mydoxie

mydoxie commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Bot review

Verdict: OK to merge. I found nothing blocking.

What I checked:

  • Exit codes. No command, an unknown command, wrong args and a thrown error now exit with 1. dox help, make:model Post and make:model Category -m still exit with 0. serve did not change: it still starts the watcher and the server and keeps running.
  • make:model. Without -m the model now gets @DoxModel(table: 'posts'). This is the same guessTable that -m uses, so Category gives categories both ways. The foreign key name in dox_orm still comes from the class name (post_id), so it does not change.
  • fillable. The stub matches dox_orm: List<String> get fillable in Model. The default there is already an empty list and guarded is ['*']. So the empty list in the stub changes nothing at run time. It only shows the user where to add columns.
  • Serve warning. It shows for any arg that is not --ignore-build-runner. The server still starts.
  • migration:rollback. --step=2 --force works in any order. --force is not passed on, so bin/migrate.dart gets rollback --step=2. A bad value like --step=x or --stepx=2 exits with 1. A "no" stops before the migration runs.
  • Changelog is under ## Unreleased. No version bump.
  • Local run: dart analyze has no issues. dart test passes (127 tests). CI is green.

Small notes (not blocking):

  1. migration:rollback --step=2 --step=3 takes the last value with no message.
  2. The serve warning always says APP_PORT=8080, also when the user typed another port, like --port=3000.
  3. The new exit code test does not cover the case where a command throws.
  4. An app on an old dox_orm with no fillable getter gets an analyzer warning for @override. It is only a warning, not an error.
  5. make:model Post on an app that already has a singular post table now points to posts. This only touches new files, and it is the fix the PR wants.

@necessarylion
necessarylion merged commit 00ff3ac into main Nov 2, 2026
1 check passed
@necessarylion
necessarylion deleted the fix/cli-small-fixes branch November 2, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants