Skip to content

room adjustments - #68

Merged
joelteply merged 2 commits into
mainfrom
canary
Apr 25, 2026
Merged

joelteply merged 2 commits into
mainfrom
canary

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

No description provided.

joelteply and others added 2 commits April 24, 2026 21:14
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
Copilot AI review requested due to automatic review settings April 25, 2026 02:58
@joelteply
joelteply merged commit 738b368 into main Apr 25, 2026
3 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

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_connect to apply inferred room when --room isn’t explicitly provided (opt-out via AIRC_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.

Comment thread airc
--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 ;;

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

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

Suggested change
--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
;;

Copilot uses AI. Check for mistakes.
Comment thread airc
Comment on lines +83 to +94
# 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.

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

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).

Suggested change
# 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.

Copilot uses AI. Check for mistakes.
Comment thread airc
fi
fi

local target="${1:-}"

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
local target="${1:-}"
local target="${1:-}"
if [ -z "$target" ] && [ "$use_room" = "1" ]; then
echo " Hosting #${room_name}"
fi

Copilot uses AI. Check for mistakes.
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