@su-sws/synthetic-web-team 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +79 -50
- package/README.md +22 -11
- package/package.json +3 -3
- package/packages/cli/bin/sws.mjs +22 -19
- package/packages/cli/src/checks.mjs +71 -1
- package/packages/cli/src/standards.mjs +26 -0
- package/packages/wizard/bin/wizard.mjs +112 -24
- package/packages/wizard/src/emit.mjs +672 -75
- package/skills/role-devops/SKILL.md +25 -2
- package/skills/role-frontend-developer/SKILL.md +9 -0
- package/skills/sws-code-review/SKILL.md +121 -0
- package/skills/sws-deploy/SKILL.md +13 -0
- package/skills/sws-github/SKILL.md +65 -1
- package/skills/sws-install/SKILL.md +23 -4
- package/skills/sws-onboard/SKILL.md +7 -4
- package/standards/recipes/add-to-existing/RECIPE.md +9 -0
- package/standards/recipes/astro-ssr/RECIPE.md +4 -1
- package/standards/recipes/astro-static/RECIPE.md +31 -1
- package/standards/recipes/astro-static/acceptance.yml +22 -0
- package/standards/recipes/next-ssr/RECIPE.md +7 -0
|
@@ -19,6 +19,14 @@ page here.
|
|
|
19
19
|
beyond `github-pages`.** Each of those silently converts push-to-main into a
|
|
20
20
|
pull-request requirement. If a project already has them, leave them and report;
|
|
21
21
|
someone may have added them deliberately.
|
|
22
|
+
- **No blocking hooks.** Not husky, lefthook, or a pre-commit or pre-push hook,
|
|
23
|
+
and no agent hook that can refuse (Claude Code `PreToolUse` or `Stop`). A check
|
|
24
|
+
that refuses a commit gets bypassed; a red check in CI gets looked at.
|
|
25
|
+
`sws check` reports hooks it finds, as advice. Existing ones stay unless the
|
|
26
|
+
team agrees to move them.
|
|
27
|
+
- **Nothing shared lives in `.claude/`.** Many teams git-ignore it, so a workflow
|
|
28
|
+
or `.mcp.json` that calls a script there works on one machine and breaks in CI.
|
|
29
|
+
Shared scripts go in `scripts/`.
|
|
22
30
|
- **`.gitignore` covers `node_modules`, build output, `.sws/prior-art.local.yml`**
|
|
23
31
|
(a local index that must never be committed) **and `.sws/axe-results.json`**
|
|
24
32
|
(derived from a build; committing it lets a stale pass travel with the repo).
|
|
@@ -46,6 +54,19 @@ Full permissions block, Pages action versions, and the two gotchas
|
|
|
46
54
|
(`upload-pages-artifact@v4` excludes dotfiles; subpath deploys need `base`) are in
|
|
47
55
|
`sws-deploy`.
|
|
48
56
|
|
|
57
|
+
Beside `build` and `deploy`, a **`checks` job** runs lint, typecheck, tests, and
|
|
58
|
+
a check that fails on switched-off tests (`.only`, `.skip`, `.fixme`). The
|
|
59
|
+
deploy job does not `need` it, so a failure there is a red check on the commit
|
|
60
|
+
and never a held-back publish. The job is in `astro-static` step 8.
|
|
61
|
+
|
|
62
|
+
**Pull requests get two reviews before a person's**: Copilot
|
|
63
|
+
(`gh pr edit <pr> --add-reviewer @copilot`) and an agent running
|
|
64
|
+
`sws-code-review`, which reads the diff cold against SWS standards. Fix or answer
|
|
65
|
+
each thread from either and resolve it. Review again after fixes, at most twice
|
|
66
|
+
each. Threads a person started are theirs. If the Copilot request fails, its
|
|
67
|
+
review is not enabled for the repository; say so and carry on. Commands for
|
|
68
|
+
every step are in `sws-github`.
|
|
69
|
+
|
|
49
70
|
## The report has to reach a reader
|
|
50
71
|
|
|
51
72
|
This is the part that gets designed wrong. A report nobody sees is worse than no
|
|
@@ -80,8 +101,10 @@ deploys with the site.
|
|
|
80
101
|
|
|
81
102
|
## Everything is advisory except one thing
|
|
82
103
|
|
|
83
|
-
**The job succeeds regardless of findings.**
|
|
84
|
-
is the
|
|
104
|
+
**The build-and-deploy job succeeds regardless of findings.** Two others can go
|
|
105
|
+
red: the `checks` job, whose failure is the nag and holds nothing back, and a
|
|
106
|
+
separate, small, fast secrets job, which is the one thing in the system that
|
|
107
|
+
blocks.
|
|
85
108
|
|
|
86
109
|
The secrets message must differ by context. On a pull request, blocking stops the
|
|
87
110
|
leak from landing. On a push to `main` the commit is already in the remote's
|
|
@@ -165,3 +165,12 @@ hardcoded hex, a removed focus outline, a hover or focus state that is only a
|
|
|
165
165
|
colour change, an island that did not need to be one, an image without
|
|
166
166
|
dimensions, and a heading level chosen for its size. That list catches most of
|
|
167
167
|
what actually goes wrong.
|
|
168
|
+
|
|
169
|
+
On a pull request, let two reviewers go first: Copilot (`gh pr edit <pr>
|
|
170
|
+
--add-reviewer @copilot`), and `sws-code-review` in a separate agent, which
|
|
171
|
+
checks this list among others. Fix or answer each of their threads and resolve
|
|
172
|
+
them, so the person reviewing after you sees only what is left. Answer from the
|
|
173
|
+
standards rather than adopting a suggestion that contradicts them: Copilot does
|
|
174
|
+
not know that the Global Footer is immutable or that Decanter's CSS wins on
|
|
175
|
+
tokens. Leave threads a person started for that person. The full steps, with
|
|
176
|
+
commands, are in `sws-github`.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sws-code-review
|
|
3
|
+
description: Review a pull request on a Stanford site as a second reviewer, alongside Copilot and before a person. Use when a pull request is opened or updated, when asked to review a diff or a branch, or when preparing a change for someone else to review. Reads the diff cold against SWS standards, posts findings as one comment-only review, and never blocks a merge.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code review, by an agent that did not write the change
|
|
7
|
+
|
|
8
|
+
Copilot reviews every pull request (see `sws-github`), but it does not know SWS
|
|
9
|
+
policy, and one automated reviewer is a single point of failure. This is the
|
|
10
|
+
second review: aware of the standards, independent of the author, and done
|
|
11
|
+
before a person spends time on the change.
|
|
12
|
+
|
|
13
|
+
## Independence is the point
|
|
14
|
+
|
|
15
|
+
An author reviewing their own change confirms what they meant to write. So:
|
|
16
|
+
|
|
17
|
+
- **If your tool can start a separate agent** (a subagent, a second session, a
|
|
18
|
+
background task), have it do the review. Give it the pull request number,
|
|
19
|
+
this skill, and where the standards are. **Do not give it your summary of the
|
|
20
|
+
change, your reasoning, or the list of things you already checked.** It reads
|
|
21
|
+
the diff cold, and its report comes back as findings, not as agreement.
|
|
22
|
+
- **If it cannot**, review after the work is finished, from the diff alone, as
|
|
23
|
+
if a stranger wrote it. Say in the review body that the author reviewed their
|
|
24
|
+
own change, so a person can weigh it accordingly.
|
|
25
|
+
|
|
26
|
+
Never present a self-review as an independent one.
|
|
27
|
+
|
|
28
|
+
## What to read
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
gh pr view <pr> --json title,baseRefName,headRefOid,files
|
|
32
|
+
gh pr diff <pr>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Read a changed file in full wherever the diff is not enough to judge it. Read
|
|
36
|
+
`AGENTS.md`, then `.sws/manifest.yml`, whose recorded divergences are decisions
|
|
37
|
+
rather than findings, and `.sws/acknowledged.yml`, whose accepted risks are not
|
|
38
|
+
new findings. Leave the pull request description for last, if at all: it is the
|
|
39
|
+
author's account of the change, and the diff is the change.
|
|
40
|
+
|
|
41
|
+
## What to look for, in this order
|
|
42
|
+
|
|
43
|
+
1. **Correctness.** A concrete input or state that gives a wrong result, a
|
|
44
|
+
crash, or lost data. Name the scenario. "Might be fragile" is not a finding.
|
|
45
|
+
2. **The one blocking thing.** A credential in the diff. Say to rotate it first,
|
|
46
|
+
then clean history, as `minweb.no-secrets` does. Everything else is advice.
|
|
47
|
+
3. **Page furniture.** The Global Footer typed by hand rather than taken from
|
|
48
|
+
`standards/fragments/global-footer.yml`; anything above the Identity Bar
|
|
49
|
+
except a skip link; the named owners no longer discoverable on the site.
|
|
50
|
+
4. **Accessibility the tools miss.** The list in `role-frontend-developer`: a
|
|
51
|
+
`div` that should be a `button`, a removed focus outline, a hover or focus
|
|
52
|
+
state that is only a colour change, a heading level chosen for its size, an
|
|
53
|
+
image with no alt text or dimensions. Automated checks catch about 30
|
|
54
|
+
percent of issues, so this is where much of the rest gets caught.
|
|
55
|
+
5. **Drift from the standards.** A hardcoded hex instead of a Decanter token,
|
|
56
|
+
Decanter 7, a pinned version, a `tailwind.config.js`, a content backend, a
|
|
57
|
+
blocking git or agent hook, a committed file that points into `.claude/`, or
|
|
58
|
+
a departure from the recipe with no entry in `.sws/manifest.yml`.
|
|
59
|
+
6. **Tests.** New logic with nothing that would fail if it broke, or a test
|
|
60
|
+
switched off with `.only`, `.skip` or `.fixme`.
|
|
61
|
+
|
|
62
|
+
Check the standards and prior art before calling something wrong: a choice
|
|
63
|
+
repeated across lineages is a convention. **Cite the standard for every policy
|
|
64
|
+
finding.** If you cannot cite one, it is a preference; leave it out or label it
|
|
65
|
+
as one.
|
|
66
|
+
|
|
67
|
+
**Keep it short.** Five real findings beat twenty nits. Skip style the linter
|
|
68
|
+
owns, and anything the author chose and recorded.
|
|
69
|
+
|
|
70
|
+
## Post it as one review that blocks nothing
|
|
71
|
+
|
|
72
|
+
One review with `"event": "COMMENT"`, never `REQUEST_CHANGES`. Pull requests are
|
|
73
|
+
never required here, and a review that holds up a merge is a gate. **Every
|
|
74
|
+
comment, and the review body, starts with `<!-- sws-code-review -->`.** That
|
|
75
|
+
marker is how the author's agent tells these threads from a person's, because
|
|
76
|
+
both are posted under the same account.
|
|
77
|
+
|
|
78
|
+
Write the file with your editor's file tool, not a shell heredoc: comment
|
|
79
|
+
bodies contain backticks, and an unquoted heredoc runs them as commands.
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"commit_id": "<head sha you reviewed>",
|
|
84
|
+
"event": "COMMENT",
|
|
85
|
+
"body": "<!-- sws-code-review -->\nAgent review: 2 findings. Advisory; nothing here blocks the merge.",
|
|
86
|
+
"comments": [
|
|
87
|
+
{
|
|
88
|
+
"path": "src/layouts/Base.astro",
|
|
89
|
+
"line": 41,
|
|
90
|
+
"side": "RIGHT",
|
|
91
|
+
"body": "<!-- sws-code-review -->\n**Focus outline removed.** ..."
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
gh api repos/<owner>/<repo>/pulls/<pr>/reviews --method POST --input review.json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`line` is a line number in the new version of the file, and it must fall inside
|
|
102
|
+
the diff, or GitHub rejects the whole review. A finding outside the diff goes in
|
|
103
|
+
the review body instead. Each comment says what is wrong, the scenario that
|
|
104
|
+
shows it, the standard it rests on, and the fix.
|
|
105
|
+
|
|
106
|
+
**No findings is a fine result.** Post the review body saying so and listing
|
|
107
|
+
what you checked, so the author and the person after them know it ran.
|
|
108
|
+
|
|
109
|
+
## Then the author deals with it
|
|
110
|
+
|
|
111
|
+
The author's agent works through these threads exactly as it does Copilot's,
|
|
112
|
+
per `sws-github`: fix it and reply with the commit, or reply with why it does
|
|
113
|
+
not apply, then resolve the thread. The reviewing agent does not resolve its own
|
|
114
|
+
threads. After fixes are pushed, review **only what changed**, at most twice.
|
|
115
|
+
|
|
116
|
+
## What this review is not
|
|
117
|
+
|
|
118
|
+
It is not approval. A person still reviews whatever they choose to, and a clean
|
|
119
|
+
agent review is no reason to skip them. It is not a compliance sign-off either:
|
|
120
|
+
`sws check` and the ODA accessibility review are separate, and no agent can
|
|
121
|
+
grant an exception (`standards/policy/escalation.md`).
|
|
@@ -31,6 +31,19 @@ fix a typo.
|
|
|
31
31
|
If a project already has branch protection, leave it. Someone may have added it
|
|
32
32
|
deliberately. Report, do not remove.
|
|
33
33
|
|
|
34
|
+
**Checks nag, they never gate.** Lint, typecheck, tests, and a check for
|
|
35
|
+
switched-off tests run in a `checks` job that the deploy job does not `need`
|
|
36
|
+
(`astro-static` step 8). Red there is the nag; the site still deploys. No git
|
|
37
|
+
hooks and no blocking agent hooks.
|
|
38
|
+
|
|
39
|
+
**When there is a pull request, two reviewers go first.** Request Copilot with
|
|
40
|
+
`gh pr edit <pr> --add-reviewer @copilot` (a draft needs the explicit request),
|
|
41
|
+
and run `sws-code-review` in a separate agent while it works. Then fix or answer
|
|
42
|
+
every thread from either and resolve it. Review again after pushing fixes, at
|
|
43
|
+
most twice each, and leave threads a person started for that person. If the
|
|
44
|
+
Copilot request fails, its review is not enabled here: say so and carry on. The
|
|
45
|
+
commands for each step are in `sws-github`.
|
|
46
|
+
|
|
34
47
|
## GitHub Pages
|
|
35
48
|
|
|
36
49
|
**To provision a repo and turn Pages on, use the `sws-github` skill** — it drives
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sws-github
|
|
3
|
-
description: Put a Stanford site on GitHub and deploy it to GitHub Pages, driven from the terminal. Use when a project needs a git repo, a GitHub remote, an org to own it, or a Pages deployment; when someone asks how to publish or where the code should live;
|
|
3
|
+
description: Put a Stanford site on GitHub and deploy it to GitHub Pages, driven from the terminal. Use when a project needs a git repo, a GitHub remote, an org to own it, or a Pages deployment; when someone asks how to publish or where the code should live; when they have no GitHub account yet; or when opening or preparing a pull request, which gets a Copilot review whose comments are fixed or answered and resolved.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Get it on GitHub, and deployed
|
|
@@ -119,6 +119,8 @@ deploys. Many campus editors work through the GitHub web UI, which is
|
|
|
119
119
|
push-to-main by construction, and they will not open a pull request to fix a
|
|
120
120
|
typo. Pull requests are first-class and never required. If a repo already has
|
|
121
121
|
protection, leave it — someone may have chosen it. Report, do not remove.
|
|
122
|
+
The same goes for git hooks: add none that can refuse a commit or a push.
|
|
123
|
+
A check belongs in CI, where failing is a red mark and stops nothing.
|
|
122
124
|
|
|
123
125
|
## The workflow
|
|
124
126
|
|
|
@@ -143,6 +145,68 @@ Two traps worth an afternoon each:
|
|
|
143
145
|
2. **A subpath deploy needs `base`** set in the framework config, or links work
|
|
144
146
|
locally and break in production. `su-sws.github.io/<repo>/` is a subpath.
|
|
145
147
|
|
|
148
|
+
## Pull requests: two reviews before a person's
|
|
149
|
+
|
|
150
|
+
Never required. When there is one, opened by you or prepared for a person to
|
|
151
|
+
review, it gets two automated reviews first: **Copilot**, and **an agent running
|
|
152
|
+
`sws-code-review`**, which knows SWS policy and Copilot does not. Then deal with
|
|
153
|
+
every comment either leaves: fix it or answer it, and resolve it either way. An
|
|
154
|
+
open thread is noise for the person who reviews after you.
|
|
155
|
+
|
|
156
|
+
1. **Start both.** A draft gets no automatic review, so always ask Copilot:
|
|
157
|
+
`gh pr edit <pr> --add-reviewer @copilot`. If that fails, Copilot code review
|
|
158
|
+
is not enabled for this repository, or `gh` is too old to know `@copilot`.
|
|
159
|
+
Say which, and carry on. Do not go and enable it. While Copilot works (it
|
|
160
|
+
takes minutes), run `sws-code-review` **in a separate agent** given the pull
|
|
161
|
+
request and not your account of it. That skill says how, and what to do if
|
|
162
|
+
your tool cannot start one.
|
|
163
|
+
2. **Wait for Copilot's review of the head commit**, then read its body as well
|
|
164
|
+
as its threads. Give up after ten minutes and say so:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
HEAD=$(gh pr view <pr> --json headRefOid -q .headRefOid)
|
|
168
|
+
REVIEWS=repos/<owner>/<repo>/pulls/<pr>/reviews
|
|
169
|
+
COPILOT=".[] | select((.user.login | test(\"copilot\"; \"i\")) and .commit_id == \"$HEAD\")"
|
|
170
|
+
for i in $(seq 20); do gh api --paginate "$REVIEWS" --jq "$COPILOT | .id" | grep -q . && break; sleep 30; done
|
|
171
|
+
gh api --paginate "$REVIEWS" --jq "$COPILOT | .body"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
3. **Work through every unresolved thread from either reviewer.** Copilot's are
|
|
175
|
+
known by their author, the agent review's by STARTING with the
|
|
176
|
+
`<!-- sws-code-review -->` marker, since it posts under your own account. A
|
|
177
|
+
person who quotes the marker has not started an agent thread. Paginated:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
gh api graphql --paginate -F owner=<owner> -F repo=<repo> -F pr=<pr> -f query='
|
|
181
|
+
query($owner: String!, $repo: String!, $pr: Int!, $endCursor: String) { repository(owner: $owner, name: $repo) {
|
|
182
|
+
pullRequest(number: $pr) { reviewThreads(first: 100, after: $endCursor) { pageInfo { hasNextPage endCursor }
|
|
183
|
+
nodes { id isResolved comments(first: 1) { nodes { author { login } path line body } } } } } } }' \
|
|
184
|
+
--jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved | not)
|
|
185
|
+
| select((.comments.nodes[0].author.login | test("copilot"; "i"))
|
|
186
|
+
or (.comments.nodes[0].body | startswith("<!-- sws-code-review -->")))'
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Fix it** and reply with what changed and the commit, or **reply with why it
|
|
190
|
+
does not apply**, citing the standard or the recorded decision. Copilot does
|
|
191
|
+
not know SWS policy: a suggestion to pin a version, add a cookie banner, or
|
|
192
|
+
touch the Global Footer is answered from `.sws/standards/`, not adopted.
|
|
193
|
+
An agent review is just as fallible, so check its claim against the code
|
|
194
|
+
before you act on it. Then resolve the thread:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
gh api graphql -f id=<thread-id> -f body='<reply>' -f query='mutation($id: ID!, $body: String!) {
|
|
198
|
+
addPullRequestReviewThreadReply(input: {pullRequestReviewThreadId: $id, body: $body}) { comment { url } } }'
|
|
199
|
+
gh api graphql -f id=<thread-id> -f query='mutation($id: ID!) {
|
|
200
|
+
resolveReviewThread(input: {threadId: $id}) { thread { isResolved } } }'
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
4. **After pushing fixes, review again**: Copilot with the same command, and the
|
|
204
|
+
agent review on what changed. **At most twice each.** A third round is a
|
|
205
|
+
reviewer arguing with itself; hand over.
|
|
206
|
+
5. **A thread a person started is theirs to resolve.** It has neither Copilot's
|
|
207
|
+
login nor the marker. Reply if you have something to add. Never resolve it
|
|
208
|
+
for them.
|
|
209
|
+
|
|
146
210
|
## Verify, then say what you have not done
|
|
147
211
|
|
|
148
212
|
```bash
|
|
@@ -39,17 +39,35 @@ So: knowledge installs once per tool, the record installs once per site.
|
|
|
39
39
|
|
|
40
40
|
| Path | What |
|
|
41
41
|
|---|---|
|
|
42
|
-
| `AGENTS.md` | The behavioral contract. Repo-rooted on purpose, so a reviewer and CI can both see it |
|
|
43
|
-
|
|
|
42
|
+
| `AGENTS.md` | The behavioral contract, between `sws-agent-contract` markers. An existing `AGENTS.md` keeps its content and gets the block added; a re-run replaces only the block. Repo-rooted on purpose, so a reviewer and CI can both see it |
|
|
43
|
+
| `.sws/standards/` | Vendored, because CI has no home directory to read. Skills cite them as `standards/<path>`, which means `.sws/standards/<path>` in a project |
|
|
44
44
|
| `.sws/manifest.yml` | What this project is and what was decided. **Never overwritten** on a re-run |
|
|
45
45
|
| `.sws/acknowledged.yml` | Accepted risks, with reasons and review dates. Never overwritten |
|
|
46
46
|
| `.sws/installed.json` | Hashes of what was written, so an update can tell a local edit from an old version. Commit it |
|
|
47
|
-
| Editor pointers | `CLAUDE.md`, `.cursor/rules/sws.mdc
|
|
47
|
+
| Editor pointers | `CLAUDE.md` and `GEMINI.md` are exactly `@AGENTS.md`, as Next.js writes them; an existing one keeps its content and gets the line. `.github/copilot-instructions.md` and `.codex/config.toml` get a marked pointer added. `.cursor/rules/sws.mdc` and `.devin/rules/sws.md` are ours by name. All point at `AGENTS.md` and `.sws/`, never content copies |
|
|
48
|
+
| MCP configs | `.mcp.json`, `.vscode/mcp.json`, `.cursor/mcp.json`, `.agents/mcp_config.json` get the `sws` server added next to the project's own. One the project removed is not put back. A file with comments is reported, not rewritten |
|
|
49
|
+
|
|
50
|
+
Nothing else goes at the root, and nothing goes in `.claude/`: many teams
|
|
51
|
+
git-ignore it, so a committed file pointing there breaks for everyone else.
|
|
48
52
|
|
|
49
53
|
**No skills.** If you find `.agents/skills/` or `.claude/skills/` inside a
|
|
50
54
|
project, it predates the two-part install. That is not a fault and nothing
|
|
51
55
|
breaks, but the copies there are frozen and the user-level ones are what update.
|
|
52
56
|
|
|
57
|
+
**A `standards/` folder at the root** is from an earlier version. The next
|
|
58
|
+
`add .` moves every file the install record lists into `.sws/standards/`, with
|
|
59
|
+
any local edit intact and still reported as a conflict, and says so in `moved`.
|
|
60
|
+
A file the record does not list is the team's, and stays. **If the project's
|
|
61
|
+
code or CI reads them at `standards/`**, as a generated footer does, the move
|
|
62
|
+
waits: `deferred` and an `update-references` step in `next[]` list each file
|
|
63
|
+
and line. Point those at `.sws/standards/` and re-run.
|
|
64
|
+
|
|
65
|
+
**A conflict on `AGENTS.md` with reason `legacy-contract`** means an older,
|
|
66
|
+
unmarked copy of the contract sits next to the project's own rules, so the
|
|
67
|
+
wizard cannot tell where it ends. Ask before touching it. Then delete that copy,
|
|
68
|
+
keeping their rules, and re-run; or `--force`, which replaces from its heading
|
|
69
|
+
to the next top-level heading.
|
|
70
|
+
|
|
53
71
|
## What to do with the result
|
|
54
72
|
|
|
55
73
|
Read the JSON, not the prose. Four fields matter:
|
|
@@ -59,7 +77,8 @@ Read the JSON, not the prose. Four fields matter:
|
|
|
59
77
|
- **`incomplete[]`** — manifest fields still holding placeholders. **Ask the
|
|
60
78
|
person.** MinWeb requires a named business owner and technical administrator
|
|
61
79
|
with real Stanford email addresses, so never invent one.
|
|
62
|
-
- **`counts`** — tells a fresh install from a no-op re-run.
|
|
80
|
+
- **`counts`** — tells a fresh install from a no-op re-run. `merged` counts
|
|
81
|
+
files that already had the project's own content, which is kept.
|
|
63
82
|
- **`dependency`** — whether `@su-sws/synthetic-web-team` reached the project's
|
|
64
83
|
`devDependencies`. It has to, because unscoped `sws` on the public registry is
|
|
65
84
|
an unrelated package and `npx sws` would otherwise run that instead of this
|
|
@@ -38,9 +38,10 @@ without being asked.
|
|
|
38
38
|
3. **`.sws/acknowledged.yml`**. Accepted risks with reasons and review dates. Do
|
|
39
39
|
not re-raise an acknowledged finding as if it were new. If a `review_by` date
|
|
40
40
|
has passed, that is worth mentioning once, kindly.
|
|
41
|
-
4. **The recipe** named in the manifest, at
|
|
42
|
-
|
|
43
|
-
project.
|
|
41
|
+
4. **The recipe** named in the manifest, at
|
|
42
|
+
`.sws/standards/recipes/<id>/RECIPE.md` (`standards/` at the root, in a
|
|
43
|
+
project an older version installed), plus its `acceptance.yml`, which is the
|
|
44
|
+
definition of correct for this project.
|
|
44
45
|
|
|
45
46
|
## Tier changes the obligations
|
|
46
47
|
|
|
@@ -80,6 +81,8 @@ Then get on with the actual task.
|
|
|
80
81
|
## If the manifest is stale
|
|
81
82
|
|
|
82
83
|
`sws doctor` compares the recorded standards version against what is installed.
|
|
83
|
-
When it is behind, say so once and offer
|
|
84
|
+
When it is behind, say so once and offer to run
|
|
85
|
+
`npx @su-sws/synthetic-web-team add .`, which is the update. There is no
|
|
86
|
+
`sws update`.
|
|
84
87
|
**Never update without being asked.** A project pinned to older standards may be
|
|
85
88
|
mid-review, or may have shipped and be under change control.
|
|
@@ -67,6 +67,15 @@ Listed so the recipe covers them.
|
|
|
67
67
|
does not approve or remove them.
|
|
68
68
|
- **A hand-built footer that is close but not exact.** The footer check will say
|
|
69
69
|
where it differs.
|
|
70
|
+
- **Blocking hooks**: husky, lefthook, a pre-commit config, or agent hooks in a
|
|
71
|
+
committed `.claude/settings.json`. `sws check` reports them, as advice. They
|
|
72
|
+
are the team's choice, so leave them, add none, and suggest moving the check
|
|
73
|
+
into a CI job the deploy does not wait on (`astro-static` step 8).
|
|
74
|
+
- **Its own `AGENTS.md`, `CLAUDE.md` and `.mcp.json`.** `add .` keeps all three:
|
|
75
|
+
the contract goes between markers at the end of `AGENTS.md`, `CLAUDE.md` gets
|
|
76
|
+
`@AGENTS.md` if it lacks it, and the `sws` server joins the project's own MCP
|
|
77
|
+
servers. Scripts that a committed file calls belong in `scripts/`, not in
|
|
78
|
+
`.claude/`, which many teams git-ignore.
|
|
70
79
|
|
|
71
80
|
## What to do now
|
|
72
81
|
|
|
@@ -186,7 +186,10 @@ diagnose it is the one holding the problem.
|
|
|
186
186
|
Replaces `astro-static` step 8. Both hosts deploy from their git integration
|
|
187
187
|
rather than from a Pages workflow:
|
|
188
188
|
|
|
189
|
-
- **Push to `main` deploys.** Keep the GitHub Actions workflow for checks only
|
|
189
|
+
- **Push to `main` deploys.** Keep the GitHub Actions workflow for checks only:
|
|
190
|
+
the build with `sws a11y`, `sws perf` and `sws check`, plus the `checks` job
|
|
191
|
+
from `astro-static` step 8. Red there is the nag; the host deploys anyway. No
|
|
192
|
+
git hooks, and no agent hooks that block.
|
|
190
193
|
- **Do not add branch protection or required status checks.** Each quietly
|
|
191
194
|
converts push-to-main into a pull-request requirement, and campus editors
|
|
192
195
|
working through the GitHub web UI cannot open one.
|
|
@@ -192,7 +192,7 @@ Every page uses one layout containing, in this order:
|
|
|
192
192
|
2. **Stanford Identity Bar.** Use `standards/fragments/identity-bar.yml` verbatim. Nothing may go above it except the skip link.
|
|
193
193
|
3. Local header, navigation, and page content. Unit-specific, design freely within Decanter.
|
|
194
194
|
4. Optional local footer.
|
|
195
|
-
5. **Stanford Global Footer.** Generate it from `standards/fragments/global-footer.yml`.
|
|
195
|
+
5. **Stanford Global Footer.** Generate it from `standards/fragments/global-footer.yml`, which in a project is `.sws/standards/fragments/global-footer.yml`. Read it from there at build time.
|
|
196
196
|
|
|
197
197
|
**The Identity Bar has a fixed height, and two things decide it.**
|
|
198
198
|
|
|
@@ -360,6 +360,36 @@ on:
|
|
|
360
360
|
|
|
361
361
|
Then gate only the deploy: `if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'`. A pull request gets a build plus `sws check`; a push to `main` gets a build, `sws check`, and a deploy.
|
|
362
362
|
|
|
363
|
+
**Checks nag; they never gate.** Lint, typecheck, tests, and a check for switched-off tests run in a `checks` job of their own, which the deploy job does **not** list in `needs`. A failure there is a red check on the commit that everyone can see and a person decides about, and the site still deploys. `sws check` stays in the build job, because it reads the build. Put none of this in a git hook (husky, lefthook, pre-commit) or an agent hook that blocks: nothing should refuse a commit, an edit, or a push. `sws check` reports a hook it finds, as advice.
|
|
364
|
+
|
|
365
|
+
```yaml
|
|
366
|
+
checks:
|
|
367
|
+
# Not in deploy's `needs`: red here is the nag, never a held-back publish.
|
|
368
|
+
runs-on: ubuntu-latest
|
|
369
|
+
steps:
|
|
370
|
+
- uses: actions/checkout@v7
|
|
371
|
+
- uses: actions/setup-node@v7
|
|
372
|
+
with:
|
|
373
|
+
node-version: lts/*
|
|
374
|
+
- run: npm ci
|
|
375
|
+
- run: npm run lint --if-present
|
|
376
|
+
- run: npm run typecheck --if-present
|
|
377
|
+
# Its own build and browser: nothing the build job made is on this
|
|
378
|
+
# runner, and a test over the built site (step 7) needs both.
|
|
379
|
+
- run: npm run build
|
|
380
|
+
- run: npx playwright install --with-deps chromium
|
|
381
|
+
- run: npm run test --if-present
|
|
382
|
+
- name: No switched-off tests
|
|
383
|
+
run: |
|
|
384
|
+
if git grep -nE '(^|[^[:alnum:]_$.])(test|it|describe|context)(\.[a-z]+)*\.(only|skip|fixme)([^[:alnum:]_$]|$)' -- \
|
|
385
|
+
'*.js' '*.mjs' '*.cjs' '*.ts' '*.mts' '*.cts' '*.jsx' '*.tsx'; then
|
|
386
|
+
echo "::error::A test is switched off with .only, .skip or .fixme. Turn it back on, or delete it."
|
|
387
|
+
exit 1
|
|
388
|
+
fi
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
`--if-present` runs the scripts the project defines and skips the rest, so add scripts rather than editing steps: `"typecheck": "astro check"` with `@astrojs/check` and `typescript` as dev dependencies, and `lint` and `test` once there is something for them to check. The job builds the site and installs Chromium itself, which repeats work the build job does; that is the price of the deploy never waiting on it. The last step also catches `test.only.each(...)` and a space before the call. A deliberate conditional skip trips it too. That is the nag working: a person looks, and decides.
|
|
392
|
+
|
|
363
393
|
**Do not set up branch protection, required status checks, or a protected environment beyond `github-pages`.** Each one quietly turns push-to-main into a pull-request requirement, and this recipe's audience includes people editing a page through the GitHub web UI who will not open a pull request to fix a typo.
|
|
364
394
|
|
|
365
395
|
Note that GitHub Pages serves **one site**, so a pull request gets checks but **no preview URL**. Netlify and Vercel give per-PR previews for free, which is a real reason to move once review matters. Say so rather than letting someone expect previews here.
|
|
@@ -727,6 +727,28 @@ criteria:
|
|
|
727
727
|
rather than `pass` when the token cannot see them. Never auto-remove a
|
|
728
728
|
protection rule: a team may have added one deliberately. Report and ask.
|
|
729
729
|
|
|
730
|
+
- id: workflow.no-blocking-hooks
|
|
731
|
+
requires: >
|
|
732
|
+
Checks run in CI, where a failure is a red check rather than a refused
|
|
733
|
+
commit. No shared git hook (husky, lefthook, pre-commit,
|
|
734
|
+
simple-git-hooks) and no agent hook that can block (Claude Code
|
|
735
|
+
`PreToolUse`, `Stop` or `SubagentStop` in a committed
|
|
736
|
+
`.claude/settings.json`).
|
|
737
|
+
check: workflow
|
|
738
|
+
severity: info
|
|
739
|
+
weight: 0
|
|
740
|
+
policy: null
|
|
741
|
+
mechanism: >
|
|
742
|
+
At the repository root: hook files in `.husky/`, a lefthook or pre-commit
|
|
743
|
+
config, hook keys in package.json, and blocking events under `hooks` in
|
|
744
|
+
`.claude/settings.json` unless git ignores that file, in which case it is
|
|
745
|
+
one developer's own setup. A developer's `.git/hooks` are never read.
|
|
746
|
+
Reports and suggests CI. Never removes a hook: a team may have chosen it.
|
|
747
|
+
note: >
|
|
748
|
+
Nagging, not gating. Weight 0, like workflow.no-forced-review, because a
|
|
749
|
+
team's own hook is a choice about how they work, not a fact about whether
|
|
750
|
+
the site meets Stanford's requirements.
|
|
751
|
+
|
|
730
752
|
- id: workflow.report-reaches-a-reader
|
|
731
753
|
requires: >
|
|
732
754
|
The advisory report is written to the job summary and a persistent
|
|
@@ -352,6 +352,13 @@ reading either baseline.
|
|
|
352
352
|
is right at flagship scale and wrong for a unit site with a handful of components
|
|
353
353
|
and one consumer. Read it for what thorough looks like, not as a shopping list.
|
|
354
354
|
|
|
355
|
+
**Run the checks in CI, never in a hook.** Use the `checks` job from
|
|
356
|
+
`astro-static` step 8 unchanged, with Next's scripts: `"lint": "eslint"`, which
|
|
357
|
+
`create-next-app --eslint` writes, and `"typecheck": "tsc --noEmit"`. The deploy
|
|
358
|
+
does not wait on it, so a failure is a red check rather than a held-back
|
|
359
|
+
publish. Next projects often arrive with husky and lint-staged; leave an
|
|
360
|
+
existing hook to the team that chose it, and add none.
|
|
361
|
+
|
|
355
362
|
### 10. Secrets
|
|
356
363
|
|
|
357
364
|
**Not `.env` in production.** SWS uses HashiCorp Vault, via
|