Repository navigation
Conversation
When `airc join` is run with no --room flag, derive the default
channel from the git repo at $PWD:
1. Primary — gh org from origin URL (github/gitlab/bitbucket/self-
hosted, whatever owner sits between host and repo). Stable
across machines: useideem/vHSM on a Mac and useideem/authenticator
on a Linux box both default to #useideem without coordinating
paths. Matches airc's "gh OAuth scope IS the trust boundary"
philosophy — the org that owns the code owns the room.
2. Fallback — parent-directory basename, for local-only repos with
no remote. Skipped when parent is $HOME / / / a generic workspace
root (Development, work, src, projects, github, …).
3. Backstop — #general when both signals refuse (non-git dirs).
Explicit --room X still wins. AIRC_NO_AUTO_ROOM=1 disables the
inference entirely. `airc list` continues to show every room on
the account, so switching scope is always one `/join --room <x>`
away.
97/97 integration tests pass — no regression to #general or
--no-general flows.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…t-org feat(connect): auto-scope default room from git remote org
There was a problem hiding this comment.
Pull request overview
Adds automatic room selection based on the current directory’s git context so airc join/connect defaults into a project/org room instead of always #general, with documentation updates to describe the behavior.
Changes:
- Add room auto-inference helpers (
infer_repo_org,infer_parent_room,infer_default_room) to derive a default room from git remote owner or repo parent directory. - Update
cmd_connectto apply inferred room when--roomisn’t explicitly provided (opt-out viaAIRC_NO_AUTO_ROOM=1). - Document the new auto-room behavior in the README.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
airc |
Implements git/org-based default room inference and wires it into cmd_connect. |
README.md |
Documents auto-scoped room selection behavior and opt-out/override mechanisms. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| --gist|-gist) use_gist=1; shift ;; | ||
| --no-gist|-no-gist) use_gist=0; shift ;; | ||
| --room|-room) room_name="${2:-general}"; use_room=1; shift 2 ;; | ||
| --room|-room) room_name="${2:-general}"; use_room=1; room_explicit=1; shift 2 ;; |
There was a problem hiding this comment.
--room currently does shift 2 unconditionally. If a user runs airc connect --room without providing an argument (expecting the default), shift 2 will fail under set -e and abort the command. Consider validating that $# -ge 2 before shifting 2, or shifting once and reading the next arg only when present.
| --room|-room) room_name="${2:-general}"; use_room=1; room_explicit=1; shift 2 ;; | |
| --room|-room) | |
| room_name="${2:-general}" | |
| use_room=1 | |
| room_explicit=1 | |
| if [ $# -ge 2 ]; then | |
| shift 2 | |
| else | |
| shift | |
| fi | |
| ;; |
| # the identifier is the upstream org, not a local path. | ||
| # | ||
| # Two signals, tried in order: | ||
| # | ||
| # 1. gh org from `origin` remote URL (the stable, cross-machine ID). | ||
| # useideem/vHSM on Joel's Mac + useideem/authenticator on Brian's | ||
| # Linux box both default to #useideem. No matter where on disk | ||
| # either of us keeps the checkout, the remote URL fingerprints it. | ||
| # Handles github / gitlab / bitbucket / self-hosted (just the | ||
| # owner segment between host and repo). Matches airc's "gh OAuth | ||
| # scope IS the trust boundary" philosophy — the org that owns the | ||
| # code is the room that discusses it. |
There was a problem hiding this comment.
The comment above says the identifier is the upstream org, but infer_repo_org uses the origin remote only. In common fork workflows, origin points at the fork owner (user) while upstream points at the shared project org, so this may scope to the wrong room. Either update the comment to match the implemented behavior, or prefer upstream when present (fall back to origin).
| # the identifier is the upstream org, not a local path. | |
| # | |
| # Two signals, tried in order: | |
| # | |
| # 1. gh org from `origin` remote URL (the stable, cross-machine ID). | |
| # useideem/vHSM on Joel's Mac + useideem/authenticator on Brian's | |
| # Linux box both default to #useideem. No matter where on disk | |
| # either of us keeps the checkout, the remote URL fingerprints it. | |
| # Handles github / gitlab / bitbucket / self-hosted (just the | |
| # owner segment between host and repo). Matches airc's "gh OAuth | |
| # scope IS the trust boundary" philosophy — the org that owns the | |
| # code is the room that discusses it. | |
| # the identifier comes from the git remote owner, not a local path. | |
| # | |
| # Two signals, tried in order: | |
| # | |
| # 1. Remote owner from the `origin` URL (the stable, cross-machine ID). | |
| # useideem/vHSM on Joel's Mac + useideem/authenticator on Brian's | |
| # Linux box both default to #useideem. No matter where on disk | |
| # either of us keeps the checkout, the remote URL fingerprints it. | |
| # Handles github / gitlab / bitbucket / self-hosted (just the | |
| # owner segment between host and repo). Matches airc's "gh OAuth | |
| # scope IS the trust boundary" philosophy — the owner on `origin` | |
| # is the room that discusses that checkout by default. |
| fi | ||
| fi | ||
|
|
||
| local target="${1:-}" |
There was a problem hiding this comment.
New auto-room inference logic is introduced here, but the integration test suite doesn’t appear to cover it (no tests mention AIRC_NO_AUTO_ROOM or validating that a git remote owner changes the default room). Adding a gh-free test that creates a temp git repo with an origin URL and asserts airc connect --no-gist prints/records Hosting #<owner> would help prevent regressions.
| local target="${1:-}" | |
| local target="${1:-}" | |
| if [ -z "$target" ] && [ "$use_room" = "1" ]; then | |
| echo " Hosting #${room_name}" | |
| fi |
No description provided.