Skip to content

Commit a63470d

Browse files
durandomclaude
andcommitted
refactor: replace cross-skill symlinks with gog CLI and local copies
Remove all 3 symlinks (gcloud_token.py, check_gsheets.py, formatters.py) that depended on rhdh-test-plan-review and rhdh skills being co-installed. Replace Google SDK/gcloud auth with gog CLI for Sheets and Docs access. Replace stale release-process.md copy with live `gog docs cat` reference. Add _find_parse_issues() discovery for rhdh-jira skill at runtime. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d824ab3 commit a63470d

19 files changed

Lines changed: 776 additions & 321 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ htmlcov/
2727
.DS_Store
2828
Thumbs.db
2929

30+
# OAuth credentials
31+
client_secret*.json
32+
3033
# uv
3134
.python-version
3235

skills/rhdh-release/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: |
66
"release dates", "release status", "feature freeze", "code freeze",
77
"blocker bugs", "CVEs", "release notes", "team breakdown", or any
88
RHDH release management question.
9-
compatibility: "acli on PATH. Python 3 + gcloud CLI for Google Sheets."
9+
compatibility: "acli on PATH. Python 3 + gog CLI for Google Sheets/Docs."
1010
---
1111

1212
<essential_principles>
@@ -109,8 +109,8 @@ What would you like to do?
109109
|-----------|---------|-----------|
110110
| `references/jql-release.md` | 12 release-specific JQL templates | Any Jira query for release data |
111111
| `references/slack-templates.md` | 4 Slack announcement templates | Generating freeze announcements |
112-
| `references/config.md` | GDrive IDs, project keys, dashboards | Looking up config values or links |
113-
| `references/release-process.md` | Y-stream/Z-stream lifecycle, checklists | Release process questions, onboarding |
112+
| `references/config.md` | GDrive IDs, project keys, dashboards, gog setup | Looking up config values or links |
113+
| `gog docs cat 13OkypJ3u_7Jq6kEhKhjEFwHQ12oPFDKXVzFjYW4XLdk` | Release process (live Google Doc) | Release process questions, onboarding |
114114
| `../../rhdh-jira/references/auth.md` | Jira auth setup | Jira prerequisite fails |
115115
| `../../rhdh-jira/references/acli-commands.md` | acli command reference | Building acli commands |
116116

@@ -123,6 +123,6 @@ What would you like to do?
123123
| Requirement | Check | Fix |
124124
|-------------|-------|-----|
125125
| **Jira CLI** | `acli jira workitem search --jql "project=RHIDP" --count` succeeds | Load `../../rhdh-jira/SKILL.md` Prerequisites |
126-
| **Google Sheets** (for team/schedule data) | `python scripts/check_gsheets.py` → exit 0 | Run `gcloud auth login --enable-gdrive-access` |
126+
| **gog CLI** (for Google Sheets/Docs) | `gog sheets metadata 1vQXfvID72qwqvLb17eyGOvnZXrZG7NBzTGv6RP9wvyM --json` succeeds | Install gog and run `gog auth add <email>` |
127127

128128
</prerequisites>

skills/rhdh-release/references/config.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release Manager Configuration
22

3-
Static configuration values for the RHDH Release Manager skill. For dashboards, key documents, and Jira project descriptions, see `release-process.md`.
3+
Static configuration values for the RHDH Release Manager skill.
44

55
## JQL Scope
66

@@ -14,3 +14,14 @@ Static configuration values for the RHDH Release Manager skill. For dashboards,
1414
|-----|-------|-------------|
1515
| `team_mapping_gdrive_id` | `1vQXfvID72qwqvLb17eyGOvnZXrZG7NBzTGv6RP9wvyM` | RHDH Team Mapping spreadsheet (sheet: "Team") |
1616
| `release_schedule_gdrive_id` | `1knVzlMW0l0X4c7gkoiuaGql1zuFgEGwHHBsj-ygUTnc` | RHDH Release Schedule spreadsheet |
17+
| `release_process_doc_id` | `13OkypJ3u_7Jq6kEhKhjEFwHQ12oPFDKXVzFjYW4XLdk` | Release process Google Doc |
18+
19+
## gog CLI Setup
20+
21+
Google Sheets and Docs access uses the [gog CLI](https://gogcli.sh).
22+
23+
1. Install: `brew install gogcli` (requires Homebrew; `brew trust openclaw/tap` if prompted)
24+
2. Get OAuth credentials: request `client_secret.json` from <mhild@redhat.com>
25+
3. Import credentials: `gog auth credentials client_secret.json`
26+
4. Authenticate: `gog auth add <your-email> --services sheets,docs,drive`
27+
5. Verify: `gog sheets metadata 1vQXfvID72qwqvLb17eyGOvnZXrZG7NBzTGv6RP9wvyM --json`

skills/rhdh-release/references/release-process.md

Lines changed: 0 additions & 150 deletions
This file was deleted.

skills/rhdh-release/scripts/check_gsheets.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

skills/rhdh-release/scripts/fetch_team_mapping.py

Lines changed: 30 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
1-
#!/usr/bin/env -S uv run --script
2-
# /// script
3-
# requires-python = ">=3.10"
4-
# dependencies = [
5-
# "google-api-python-client>=2.0",
6-
# "google-auth>=2.0",
7-
# "google-auth-httplib2>=0.2",
8-
# ]
9-
# ///
10-
# Note: uses uv run --script for Google API deps (see ADR-0002 for stdlib-only rationale;
11-
# Google Sheets SDK is an intentional exception)
12-
"""Fetch RHDH team mapping from the Team spreadsheet."""
1+
#!/usr/bin/env python3
2+
"""Fetch RHDH team mapping from the Team spreadsheet via gog CLI."""
133

144
import argparse
155
import json
166
import os
7+
import shutil
8+
import subprocess
179
import sys
18-
from pathlib import Path
19-
20-
_scripts_dir = Path(__file__).resolve().parent
21-
if str(_scripts_dir) not in sys.path:
22-
sys.path.insert(0, str(_scripts_dir))
23-
24-
from gcloud_token import get_gcloud_token # noqa: E402
2510

2611
_no_color = os.environ.get("NO_COLOR") is not None
2712
_is_tty = sys.stderr.isatty() and not _no_color
@@ -44,24 +29,35 @@ def error_exit(error_key, extra=None):
4429
sys.exit(1)
4530

4631

47-
def get_sheets_service():
48-
from google.oauth2.credentials import Credentials
49-
from googleapiclient.discovery import build
32+
def fetch_sheet_values(sheet_id, sheet_name):
33+
"""Fetch sheet values via gog sheets get --json --results-only."""
34+
gog = shutil.which("gog")
35+
if not gog:
36+
error_exit("gog_not_found", {"hint": "Install gog CLI: https://github.com/thediveo/gog"})
5037

51-
token, gcloud_err = get_gcloud_token()
52-
if not token:
53-
if gcloud_err and "PATH" in gcloud_err:
38+
result = subprocess.run(
39+
["gog", "sheets", "get", sheet_id, sheet_name, "--json", "--results-only"],
40+
capture_output=True,
41+
text=True,
42+
)
43+
if result.returncode != 0:
44+
stderr = result.stderr.strip()
45+
if "accessNotConfigured" in stderr:
5446
error_exit(
55-
"gcloud_not_found",
56-
{"hint": "Install the Google Cloud CLI and ensure gcloud is on your PATH"},
47+
"sheets_api_disabled",
48+
{"hint": "Enable Google Sheets API in your gog OAuth project"},
5749
)
58-
error_exit(
59-
"credentials_not_found",
60-
{"hint": "Run 'gcloud auth login --enable-gdrive-access' to authenticate"},
61-
)
50+
if "404" in stderr or "not found" in stderr.lower():
51+
error_exit(
52+
"spreadsheet_not_found",
53+
{
54+
"spreadsheet_id": sheet_id,
55+
"hint": "The spreadsheet was not found. Pass the correct ID with --sheet-id.",
56+
},
57+
)
58+
error_exit("gog_error", {"stderr": stderr})
6259

63-
creds = Credentials(token=token)
64-
return build("sheets", "v4", credentials=creds)
60+
return json.loads(result.stdout)
6561

6662

6763
def parse_teams(rows, category_filter=None, include_all=False):
@@ -163,29 +159,7 @@ def main():
163159

164160
log("Fetching team mapping...")
165161

166-
service = get_sheets_service()
167-
168-
from googleapiclient.errors import HttpError
169-
170-
try:
171-
result = (
172-
service.spreadsheets()
173-
.values()
174-
.get(spreadsheetId=args.sheet_id, range=args.sheet_name)
175-
.execute()
176-
)
177-
except HttpError as e:
178-
if e.resp.status == 404:
179-
error_exit(
180-
"spreadsheet_not_found",
181-
{
182-
"spreadsheet_id": args.sheet_id,
183-
"hint": "The spreadsheet was not found. Pass the correct ID with --sheet-id.",
184-
},
185-
)
186-
raise
187-
188-
rows = result.get("values", [])
162+
rows = fetch_sheet_values(args.sheet_id, args.sheet_name)
189163
if not rows:
190164
error_exit("empty_sheet", {"sheet_name": args.sheet_name})
191165

skills/rhdh-release/scripts/formatters.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)