Repository navigation
Commit 9f397f3
fix(github): properly parse scopes and use additive refresh
Rewrote PhpStorm token function based on official gh CLI documentation:
BEFORE (broken):
- Parsed human-readable text output with sed/grep/tr hacks
- Resulted in malformed scope strings with quotes and duplicates
- Tried to pass ALL scopes to gh auth refresh (unnecessary)
- Failed with "invalid_scope" errors
AFTER (correct):
- Uses gh auth status --json hosts for structured data
- Parses scopes array with jq (reliable JSON parsing)
- Only adds MISSING scopes (gh auth refresh --scopes is additive)
- Preserves all existing scopes automatically
Key insight from documentation: --scopes flag is ADDITIVE, not replacement.
No need to manually merge scopes - just pass missing ones.
Based on official documentation:
- gh auth refresh: https://cli.github.com/manual/gh_auth_refresh
- gh auth status: https://cli.github.com/manual/gh_auth_status
- JSON output: cli/cli#8637
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>1 parent 4a3f165 commit 9f397f3
1 file changed
Lines changed: 17 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
672 | | - | |
673 | | - | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
674 | 675 | | |
675 | 676 | | |
676 | | - | |
| 677 | + | |
677 | 678 | | |
678 | 679 | | |
679 | | - | |
680 | | - | |
| 680 | + | |
681 | 681 | | |
682 | | - | |
| 682 | + | |
683 | 683 | | |
684 | | - | |
685 | | - | |
| 684 | + | |
686 | 685 | | |
687 | 686 | | |
688 | 687 | | |
689 | | - | |
690 | | - | |
| 688 | + | |
| 689 | + | |
691 | 690 | | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
| 691 | + | |
| 692 | + | |
697 | 693 | | |
698 | 694 | | |
699 | 695 | | |
| 696 | + | |
700 | 697 | | |
701 | 698 | | |
702 | 699 | | |
703 | | - | |
704 | | - | |
| 700 | + | |
| 701 | + | |
705 | 702 | | |
706 | | - | |
707 | | - | |
| 703 | + | |
| 704 | + | |
708 | 705 | | |
709 | 706 | | |
710 | 707 | | |
| |||
716 | 713 | | |
717 | 714 | | |
718 | 715 | | |
719 | | - | |
| 716 | + | |
720 | 717 | | |
721 | 718 | | |
722 | 719 | | |
| |||
0 commit comments