Skip to content

Commit 21b9d8c

Browse files
Merge pull request #6 from Aaryan-Kapoor/feat/product-polish
feat: product polish — recovered agent-first work, real assets, new banner/README, self-refreshing auth
2 parents 82e27fe + 9c696a2 commit 21b9d8c

76 files changed

Lines changed: 5085 additions & 644 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.10", "3.11", "3.12", "3.13"]
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- name: Install
20+
run: python -m pip install -e .
21+
- name: Compile
22+
run: python -m compileall -q src tests
23+
- name: Test
24+
run: python -m unittest discover -s tests -v

AGENTS.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ You have access to the `d2l` CLI tool which fetches READ-ONLY data from the user
55
## Quick Reference
66

77
```bash
8+
# Setup & diagnosis
9+
d2l --json doctor # Full setup state + the exact next command to run
10+
d2l setup --list-schools # Known school presets
11+
d2l setup --school gsu # Configure a preset school
12+
d2l setup --host https://your-school.view.usg.edu # Any Brightspace school
13+
814
# Identity & auth
915
d2l token # Check if token is valid
1016
d2l whoami # Current user info
@@ -76,12 +82,23 @@ d2l onboard # Interactive course SOP setup
7682
d2l onboard --yes # Non-interactive starter SOP
7783
```
7884

85+
## First-Time Setup
86+
87+
Run `d2l --json doctor` before anything else. It reports every setup check
88+
(config, token, API access, courses, onboarding) with a `next_step` command —
89+
follow it instead of guessing state.
90+
91+
If no school is configured, ask the user which school they attend, then run
92+
`d2l setup --school NAME` (see `d2l setup --list-schools`) or
93+
`d2l setup --host <their Brightspace URL>`. Never edit source files to
94+
configure a school.
95+
7996
## Agent Defaults
8097

8198
1. **Read-only only.** Use `d2l` only for read-only Brightspace data. Never submit assignments, post discussions, modify grades, change settings, or perform actions that mutate D2L state.
8299
2. **Prefer structured output.** Use `--md` or `--json` when processing data. Human/table output is for display only.
83100
3. **Put global flags before the command.** Use `d2l --md grades "calc"`, not `d2l grades --md "calc"`.
84-
4. **Handle auth failures safely.** If the token is expired or invalid, first try `d2l login --headless`. If that fails, hangs, or cannot capture a token, ask the user to log in to D2L again. Ask whether you may launch the browser for them, then run `d2l login` so they can complete the login interactively.
101+
4. **Auth maintains itself.** The CLI silently refreshes expired tokens using the saved browser session before any command fails. If a command still reports a sign-in error, the saved session has fully expired — ask the user whether you may launch `d2l login`, then run it so they can log in interactively. Never ask them to copy tokens or open DevTools.
85102
5. **No browser scraping.** Do not use browser automation, page scraping, or in-page JavaScript to retrieve D2L course data. Browser login is only for authentication; course data should come from the CLI/API paths.
86103
6. **Resolve courses carefully.** Course arguments can be fuzzy names, course codes, or numeric org unit IDs. If multiple courses match, ask the user to disambiguate or use the numeric ID.
87104
7. **Fetch policy sources first.** For grading policies, course rules, grading weights, prerequisites, or instructor policies, fetch the syllabus first with `d2l --md syllabus COURSE` when available.
@@ -107,19 +124,20 @@ Course arguments accept fuzzy names, codes, or numeric IDs:
107124

108125
## When Token Expires
109126

110-
The D2L token expires every ~1 hour. If the token is expired or invalid, first try:
111-
112-
```bash
113-
d2l login --headless
114-
```
127+
Tokens expire hourly, but you normally never notice: every `d2l` command
128+
auto-refreshes the token in the background from the saved browser session.
115129

116-
If headless login fails, hangs, or cannot capture a token, ask the user whether you may launch the browser for them. If they agree, run:
130+
If a command still fails with a sign-in error, the saved session itself has
131+
expired. Ask the user whether you may launch the browser for them; if they
132+
agree, run:
117133

118134
```bash
119135
d2l login
120136
```
121137

122-
The user can complete browser/SSO login interactively, and the CLI will save the refreshed token.
138+
The user completes browser/SSO login interactively, and the CLI saves the
139+
refreshed token. (`d2l login --headless` and `D2L_NO_AUTO_LOGIN=1` exist for
140+
manual control, but are rarely needed.)
123141

124142
## Important
125143

0 commit comments

Comments
 (0)