Skip to content

fix(cli): replace make users target with bin/users wrapper - #271

Merged
bihius merged 1 commit into
mainfrom
fix/user-cli-wrapper
Jul 21, 2026
Merged

fix(cli): replace make users target with bin/users wrapper#271
bihius merged 1 commit into
mainfrom
fix/user-cli-wrapper

Conversation

@bihius

@bihius bihius commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace the make users ARGS="..." convenience target with a bin/users shell wrapper
  • make was consuming any argument starting with - before it reached the Makefile, forcing awkward ARGS="..." quoting for flags like --role, --active, -h
  • bin/users execs docker-compose (falling back to docker compose) directly against the backend container, passing all arguments through unchanged
  • Update README.md, docs/commands.md, and the manage_users.py docstring to reference ./bin/users instead of make users ARGS="..."

Test plan

  • uv run pytest tests/unit/test_users_wrapper.py — covers both the docker-compose and docker compose fallback paths, and exit code passthrough

`make users ARGS="..."` swallowed any argument starting with `-`
before it reached the Makefile, forcing awkward ARGS= quoting.
bin/users execs docker-compose (falling back to `docker compose`)
directly, passing all arguments through unchanged.
Copilot AI review requested due to automatic review settings July 21, 2026 12:40
@bihius
bihius merged commit 202b9a5 into main Jul 21, 2026
5 checks passed

Copilot AI 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.

Pull request overview

This PR replaces the make users convenience target with a repository-level ./bin/users wrapper so user-management CLI arguments (especially flags like --role/-h) pass through to the backend container unchanged.

Changes:

  • Remove the users target from the Makefile and introduce a bin/users wrapper that execs Docker Compose with passthrough args.
  • Add unit tests covering docker-compose preference, docker compose v2 fallback, and exit-code passthrough.
  • Update documentation (README, commands docs, and manage_users.py docstring) to reference ./bin/users.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
bin/users New shell wrapper that runs scripts/manage_users.py inside the backend container via Compose.
Makefile Removes the users target and related argument-forwarding logic.
src/backend/tests/unit/test_users_wrapper.py Adds unit tests for wrapper argument passthrough, compose fallback, and exit code propagation.
src/backend/scripts/manage_users.py Updates Docker usage examples to use ./bin/users.
README.md Updates user-management examples to use ./bin/users.
docs/commands.md Updates user-management documentation to use ./bin/users and removes the make-flag caveat.

Comment on lines +38 to +54
bin_dir = tmp_path / "bin"
bin_dir.mkdir(exist_ok=True)
capture_path = tmp_path / "arguments.txt"
environment = {
**os.environ,
"PATH": f"{bin_dir}{os.pathsep}/usr/bin{os.pathsep}/bin",
"CAPTURE_PATH": str(capture_path),
"FAKE_EXIT_CODE": str(exit_code),
}
return subprocess.run(
[str(USERS_WRAPPER), *arguments],
cwd=tmp_path,
env=environment,
capture_output=True,
text=True,
check=False,
)
Comment on lines 15 to 18
Usage (Docker):
docker-compose ... exec backend /app/.venv/bin/python scripts/manage_users.py <cmd>
# or via make:
make users ARGS="list --json"
./bin/users create --email alice@example.com --password '<password>' --full-name "Alice"
./bin/users list --role admin --active

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.

2 participants