feat: add SessionStart hook for early auth/scope and project-existence warning#75
Merged
Merged
Conversation
…e warning Adds scripts/session-start-check.sh that runs at session start in any repo with .claude/backlog-project.json. Checks two failure conditions and emits a warning banner with a copy-paste fix command for each: 1. Missing required token scopes (repo, project, read:user; read:org when the project owner is a GitHub organisation). 2. Configured project missing or project_id mismatch, indicating the Project was deleted or re-created since initialize-backlog ran. Hook is registered in hooks/hooks.json as a SessionStart command. Always exits 0 — warns but never blocks the session. Refs #39 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #39
Summary
scripts/session-start-check.sh— runs at session start in any repo with.claude/backlog-project.json; silently exits if the file is absent (no noise in unrelated repos)hooks/hooks.jsonas aSessionStarthook via${CLAUDE_PLUGIN_ROOT}/scripts/session-start-check.shWhat the hook checks
Check 1 — required token scopes: parses
gh auth status --hostname github.comand verifiesrepo,project,read:userare present (plusread:orgwhen the project owner is a GitHub organisation). On failure, emits a banner naming the missing scopes and the exactgh auth refresh --scopes …command.Check 2 — project still exists: queries the live project ID via
gh project viewand compares it against the storedproject_idfrom.claude/backlog-project.json. On mismatch or missing project, emits a banner with the remediation (/initialize-backlogor delete the metadata file).Acceptance Criteria
scripts/session-start-check.shexists, executable,#!/usr/bin/env bashshebanghooks/hooks.jsonregisters aSessionStarthook invoking the script.claude/backlog-project.jsonpresentgh auth refresh …commandproject_id→ banner + remediation message🤖 Generated with Claude Code