-
Notifications
You must be signed in to change notification settings - Fork 0
feat!: GUI-only approval, repo slug display, version 0.2.0 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
abf9ddf
feat: show repository slug in approval dialog
lklimek a60a879
feat!: require GUI display for approval, show repo slug in dialog
lklimek 7b977da
build: read version from package metadata instead of duplicating
lklimek 8f6897d
docs: add CLAUDE.md with release process and dev guide
lklimek a21274f
docs: require HTTPS remotes, add gh auth setup-git hint
lklimek 653b7b8
fix: address Copilot review comments
lklimek 8f45c7c
test: remove 6 duplicate tests (28 → 22)
lklimek 6557795
fix: address remaining Copilot review comments
lklimek ff4bb25
fix: validate repo slug has exactly two non-empty segments
lklimek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # GitHub access — two-token model | ||
|
|
||
| You have a **read-only** `GH_TOKEN`. For write operations, use `ghsudo`: | ||
|
|
||
| ``` | ||
| ghsudo gh pr merge 123 --merge | ||
| ghsudo gh issue comment 42 --body "Done!" | ||
| ``` | ||
|
|
||
| `ghsudo` shows a dialog and runs the command with elevated permissions only after user approval. | ||
|
|
||
| ## Rules | ||
|
|
||
| - **Always** use `https://` URLs for git remotes so that `git push`/`pull` can use the `gh` credential helper. `ghsudo` itself injects `GH_TOKEN`/`GITHUB_TOKEN` for the `gh` CLI and does not depend on the remote URL scheme. If git push/pull fails over HTTPS, remind the user to run `gh auth setup-git`. | ||
| - **Never** bypass `ghsudo` or ask the user for the write token directly. | ||
| - Exit code 2 (denied or timed out): stop and report to the user. | ||
| - Exit code 3 (no GUI display or no supported dialog tool): inform the user approval is not possible. | ||
| - Exit code 4 (not set up): tell the user to follow <https://github.com/lklimek/ghsudo#readme>. | ||
|
|
||
| # ghsudo — Developer Guide | ||
|
|
||
| ## Project structure | ||
|
|
||
| - `src/ghsudo/__main__.py` — CLI entry point and all logic (single-file tool) | ||
| - `src/ghsudo/__init__.py` — package init, reads version from package metadata | ||
| - `pyproject.toml` — build config and **single source of truth for version** | ||
| - `tests/` — pytest tests | ||
|
|
||
| ## Version management | ||
|
|
||
| Version is defined **only** in `pyproject.toml`. The `__init__.py` reads it at | ||
| runtime via `importlib.metadata.version("ghsudo")`. | ||
|
|
||
| When bumping the version, edit **only** `pyproject.toml`. | ||
|
|
||
| ## Testing | ||
|
|
||
| ```bash | ||
| python -m pytest tests/ -v | ||
| ``` | ||
|
|
||
| Only run formatting/linting right before committing: | ||
|
|
||
| ```bash | ||
| python -m ruff check src/ tests/ && python -m ruff format src/ tests/ | ||
| ``` | ||
|
|
||
| ## Release process | ||
|
|
||
| 1. **Bump version** in `pyproject.toml` (semver: major.minor.patch) | ||
| 2. **Commit**: `git commit -m "build: bump version to X.Y.Z"` | ||
| 3. **Push**: `git push` | ||
| 4. **Create GitHub release** (triggers PyPI publish via CI): | ||
| ```bash | ||
| ghsudo gh release create vX.Y.Z --generate-notes | ||
| ``` | ||
| 5. **Verify** the publish workflow completes on GitHub Actions. | ||
|
|
||
| The `publish.yml` workflow builds and publishes to PyPI automatically when a | ||
| GitHub release is created. | ||
|
|
||
| ## Platform support | ||
|
|
||
| Only Linux is actively tested. macOS/Windows have basic support but are untested. | ||
|
|
||
| ## Security design | ||
|
|
||
| GUI-only approval is intentional — terminal prompts are trivially auto-approvable | ||
| by AI agents. A graphical display (`DISPLAY`/`WAYLAND_DISPLAY`) is required. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| """ghsudo — GitHub Sudo: re-execute commands with an elevated GitHub token.""" | ||
|
|
||
| __version__ = "1.0.0" | ||
| from importlib.metadata import PackageNotFoundError, version | ||
|
|
||
| try: | ||
| __version__ = version("ghsudo") | ||
| except PackageNotFoundError: | ||
| __version__ = "0.0.0+unknown" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.