@se-studio/skills 1.10.12 → 1.10.20

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/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @se-studio/skills
2
2
 
3
+ ## 1.10.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 9bb587f: Update the vercel-logs-audit skill for the Vercel CLI v64 logs commands.
8
+
9
+ ## 1.10.19
10
+
11
+ ### Patch Changes
12
+
13
+ - 12cf6c0: `pnpm fleet-audit` also checks guardrail wiring and leftovers found in the PointMe pilot: pre-commit and pre-push hooks that do not call `se-agent-guard`, a missing Claude pre-tool hook or merge-gate audit workflow, repo-local skills sync (`skills:sync`, `skills-lock.json`) instead of `skills-npm --yes`, tracked skill symlinks, extra restated docs (`review-before-merge.md`, `release-verification.md`) and review rules in process notes.
14
+
15
+ ## 1.10.18
16
+
17
+ ### Patch Changes
18
+
19
+ - 9b34052: Document the Sunday morning Screaming Frog fleet delta and brief.
20
+
21
+ ## 1.10.17
22
+
23
+ ### Patch Changes
24
+
25
+ - 5350ad5: Add `se-agent-guard core-request`: files a Core request as a `from-customer` issue in se-core-product (one open issue per project and feature, `--dry-run` supported). Customer agents block v4 and `cross-project-handoff.md` say to use it, and `pnpm fleet-audit` lists open Core requests.
26
+
27
+ ## 1.10.16
28
+
29
+ ### Patch Changes
30
+
31
+ - 71fc433: Add `pnpm fleet-audit` in core: a read-only fleet consistency audit that reads each registry project from `origin/<integration branch>` and reports stale agents blocks, restated review rules, manual-deploy and skills-update scripts, non-exact pins, skills older than 1.10.7, packages behind core, and `pushed-through` merges.
32
+
33
+ ## 1.10.15
34
+
35
+ ### Patch Changes
36
+
37
+ - 5cf974b: Merge approval no longer names one person: any authorised human may give the go (an agent records it, never approves). The gate accepts `none, approver override` alongside `none, Nick override`. Reviews by the author are fine.
38
+
39
+ ## 1.10.14
40
+
41
+ ### Patch Changes
42
+
43
+ - 1beb030: Merge gate failure message now says exactly how to fix a missing review link (names the 12-character head and the comment to post) and mentions the promote `CI covers the changes since` line only on a production promote. `AGENTS.md` and the customer block carry one `## Merge approval` template and say to hold a PR with draft or the `do not merge` label.
44
+
45
+ ## 1.10.13
46
+
47
+ ### Patch Changes
48
+
49
+ - 5c8d710: Customer agents block v3: one copy of the review and merge rules (no restated copies), the design-review security trigger and reviewer identity in step 1, and a `## Review (no code change)` note for lint-only follow-up commits.
50
+
3
51
  ## 1.10.12
4
52
 
5
53
  ### Patch Changes
package/README.md CHANGED
@@ -83,6 +83,10 @@ Do not edit `packages/contentful-cms/skills/` directly. See `packages/contentful
83
83
 
84
84
  **Do not use `.claude/skills/` in the repo** as a skill source — it is untracked and local. Use `.agents/skills/` (in this monorepo via `pnpm skills:sync`, in a customer site via `skills-npm`) or `cms-edit skill install`.
85
85
 
86
+ ## Core-only skills
87
+
88
+ `core-only/<skill>/SKILL.md` holds skills for agents working in **this repo** that must not reach customers (for example the `contentful-events-*` skills, which read an internal database). They follow the same frontmatter rules and `pnpm skills:validate` checks them, and `pnpm skills:sync` copies them into `.agents/skills` alongside the published ones. `core-only/` is deliberately absent from this package's `files` list, so it is never published to npm or linked into a customer repo. A name that exists in both `skills/` and `core-only/` fails the sync. A skill meant for customers goes in `skills/`.
89
+
86
90
  ## Vendored pstack (trial)
87
91
 
88
92
  SE Studio may vendor a **subset** of [cursor/plugins pstack](https://github.com/cursor/plugins/tree/main/pstack) skills under `skills/` for a se-core-product-only trial. See [`VENDOR_PSTACK.md`](./VENDOR_PSTACK.md) for the pin, adopt/exclude list, Auto-only adaptations, and MIT attribution (`LICENSE.pstack`). Gate rule: [`.cursor/rules/pstack-trial-gates.mdc`](../../.cursor/rules/pstack-trial-gates.mdc). Do **not** run `/setup-pstack` or install excluded skills (`poteto-mode`, `arena`, `swarm`, Benny, etc.). No npm release of these trial skills until Nick approves a customer rollout.
@@ -6,6 +6,7 @@
6
6
  * se-agent-guard push git pre-push hook (ref lines on stdin)
7
7
  * se-agent-guard claude-pretool Claude Code PreToolUse hook (payload on stdin)
8
8
  * se-agent-guard merge-gate <pr> [--audit]
9
+ * se-agent-guard core-request --from <key> --feature <slug> --why "..." file a tracked Core request
9
10
  * se-agent-guard worktrees-clean [--apply] [--remote] remove merged worktrees and branches
10
11
  */
11
12
  import { spawnSync } from 'node:child_process';
@@ -17,6 +18,7 @@ const SUBCOMMANDS = {
17
18
  push: ['cli.mjs', ['push']],
18
19
  'claude-pretool': ['claude-pretool.mjs', []],
19
20
  'merge-gate': ['merge-gate.mjs', []],
21
+ 'core-request': ['core-request.mjs', []],
20
22
  'worktrees-clean': ['worktrees-clean.mjs', []],
21
23
  };
22
24
 
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * `se-agent-guard core-request`: file a Core request as a tracked issue in se-core-product,
4
+ * so a problem found in a customer repo is fixed in core instead of living in a chat.
5
+ *
6
+ * se-agent-guard core-request --from <project_key> --feature <slug> --why "<one sentence>"
7
+ * [--packages "@se-studio/a,@se-studio/b"] [--pr <customer PR url>] [--dry-run]
8
+ *
9
+ * One open issue per (project, feature): running it twice returns the existing issue.
10
+ * Works from any repo and any agent; it only needs `gh` with access to the core repo.
11
+ */
12
+ import { execFileSync } from 'node:child_process';
13
+ import path from 'node:path';
14
+ import { fileURLToPath } from 'node:url';
15
+
16
+ export const CORE_REPO = 'Something-Else-Studio/se-core-product';
17
+ export const LABEL = 'from-customer';
18
+
19
+ /** @returns {{ title: string, body: string }} */
20
+ export function buildIssue({ from, feature, why, packages, pr }) {
21
+ const missing = Object.entries({ from, feature, why }).filter(([, v]) => !v?.trim());
22
+ if (missing.length) throw new Error(`missing: ${missing.map(([k]) => `--${k}`).join(', ')}`);
23
+ const pkgs = (packages ?? '')
24
+ .split(',')
25
+ .map((p) => p.trim())
26
+ .filter(Boolean);
27
+ return {
28
+ title: `[${from}] ${feature}`,
29
+ body: [
30
+ '## Core request',
31
+ '',
32
+ `**From site:** ${from}`,
33
+ `**Feature:** ${feature}`,
34
+ `**Why core:** ${why.trim()}`,
35
+ ...(pkgs.length ? [`**Suggested packages:** ${pkgs.map((p) => `\`${p}\``).join(', ')}`] : []),
36
+ ...(pr ? [`**Customer PR:** ${pr}`] : []),
37
+ '',
38
+ `**Site status:** parked or working around this until the fix publishes to npm.`,
39
+ '**Do not:** implement this behaviour in the customer repo.',
40
+ '',
41
+ 'Fix in core: changeset, merge to `dev`, promote, then a Site request to bump the customer.',
42
+ ].join('\n'),
43
+ };
44
+ }
45
+
46
+ const gh = (...args) =>
47
+ execFileSync('gh', args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
48
+
49
+ function parse(argv) {
50
+ const opts = {};
51
+ for (let i = 0; i < argv.length; i++) {
52
+ const a = argv[i];
53
+ if (a === '--dry-run') opts.dryRun = true;
54
+ else if (a.startsWith('--')) opts[a.slice(2)] = argv[++i];
55
+ }
56
+ return opts;
57
+ }
58
+
59
+ function main() {
60
+ const opts = parse(process.argv.slice(2));
61
+ let issue;
62
+ try {
63
+ issue = buildIssue(opts);
64
+ } catch (error) {
65
+ console.error(`core-request: ${error.message}`);
66
+ process.exit(2);
67
+ }
68
+ if (opts.dryRun) {
69
+ console.log(`${issue.title}\n\n${issue.body}`);
70
+ return;
71
+ }
72
+ const existing = JSON.parse(
73
+ gh(
74
+ 'issue',
75
+ 'list',
76
+ '-R',
77
+ CORE_REPO,
78
+ '--label',
79
+ LABEL,
80
+ '--state',
81
+ 'open',
82
+ '--limit',
83
+ '200',
84
+ '--json',
85
+ 'number,title,url',
86
+ ),
87
+ ).find((i) => i.title === issue.title);
88
+ if (existing) {
89
+ console.log(`core-request: already open as #${existing.number} ${existing.url}`);
90
+ return;
91
+ }
92
+ gh(
93
+ 'label',
94
+ 'create',
95
+ LABEL,
96
+ '-R',
97
+ CORE_REPO,
98
+ '--force',
99
+ '--color',
100
+ '5319E7',
101
+ '--description',
102
+ 'Problem found in a customer repo that is fixed in core',
103
+ );
104
+ console.log(
105
+ gh(
106
+ 'issue',
107
+ 'create',
108
+ '-R',
109
+ CORE_REPO,
110
+ '--label',
111
+ LABEL,
112
+ '--title',
113
+ issue.title,
114
+ '--body',
115
+ issue.body,
116
+ ),
117
+ );
118
+ }
119
+
120
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main();
@@ -64,7 +64,7 @@ function linksIn(body) {
64
64
  }
65
65
 
66
66
  /** The approval line `none, Nick override` must stand alone, not sit in a quote or a negation. */
67
- const OVERRIDE_LINE = /^\s*(?:\d+[.)]\s*)?none,\s*nick override\.?\s*$/im;
67
+ const OVERRIDE_LINE = /^\s*(?:\d+[.)]\s*)?none,\s*(?:nick|approver)\s+override\.?\s*$/im;
68
68
 
69
69
  /**
70
70
  * Production promote, and only these pairs: core `dev` → `main`, or a site
@@ -92,7 +92,7 @@ const CI_COVERS_LINE =
92
92
  * Anyone may approve, but the approval has to point at a review that really exists on this PR
93
93
  * at the current head: a review comment (agent or human) naming the head SHA (full, or a
94
94
  * prefix of at least 12 hex characters), with a verdict, posted before the approval.
95
- * `none, Nick override` skips it. A promote may use a whole line `CI covers the changes since`.
95
+ * `none, Nick override` (or `none, approver override`) skips it. A promote may use a whole line `CI covers the changes since`.
96
96
  * Links to PR reviews (#pullrequestreview-N) are
97
97
  * not accepted: gh returns no numeric review id, so such a link cannot be tied to a review.
98
98
  * Cannot detect a review comment edited after the approval (gh returns no updatedAt).
@@ -140,11 +140,15 @@ export function evaluateMergeGate(pr, { ignoreDraft = false } = {}) {
140
140
  'New commits since the approval need a fresh one.',
141
141
  );
142
142
  } else if (!atHead.some((c) => citedReview(c, pr))) {
143
+ const head = pr.headRefOid.slice(0, 12);
143
144
  problems.push(
144
145
  'The `## Merge approval` comment must link a review on this PR (an agent or human review comment ' +
145
- 'naming the current head SHA — the full SHA or a prefix of at least 12 hex characters — with a verdict, posted before the approval), or have a line saying `none, Nick override`. ' +
146
+ 'naming the current head SHA — the full SHA or a prefix of at least 12 hex characters — with a verdict, posted before the approval), or have a line saying `none, Nick override` (or `none, approver override`). ' +
146
147
  'A hex string that is not that prefix does not count. ' +
147
- 'A production promote (`dev` → `main`, or `develop` → `main` / `production`, same repository) may use a whole line `CI covers the changes since` with no review on that PR.',
148
+ (isProductionPromote(pr)
149
+ ? 'This is a production promote: a whole line `CI covers the changes since` also works, with no review on this PR. '
150
+ : '') +
151
+ `Fix: post a review comment headed "## Code review" that names ${head} and gives a verdict (PASS, BLOCKERS, NITs, LGTM or approved), then a \`## Merge approval\` with the line \`Review: <link to that comment>\` (see the template in AGENTS.md).`,
148
152
  );
149
153
  }
150
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/skills",
3
- "version": "1.10.12",
3
+ "version": "1.10.20",
4
4
  "description": "SE Studio agent skills for marketing site development with Contentful CMS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,6 +20,15 @@ Emit when placement says **core**, or the site is blocked on missing package beh
20
20
  **Do not:** implement this behaviour in the customer repo.
21
21
  ```
22
22
 
23
+ File it as a tracked issue, not only in chat (any agent, from any repo):
24
+
25
+ ```bash
26
+ pnpm exec se-agent-guard core-request --from <project_key> --feature <feature-slug> \
27
+ --why "<one sentence>" --packages "@se-studio/<pkg>" --pr <customer PR url>
28
+ ```
29
+
30
+ It opens an issue labelled `from-customer` in `se-core-product` (one open issue per project and feature; a repeat returns the existing one). Paste the block in chat too if the person is waiting. A customer PR that works around core behaviour in the meantime must link that issue in its body.
31
+
23
32
  Then switch to **core-first** (same multi-root chat or a core session), implement, changeset, publish.
24
33
 
25
34
  ## Site request (core → sites)
@@ -1,4 +1,4 @@
1
- <!-- BEGIN:se-core-agents-block v2 -->
1
+ <!-- BEGIN:se-core-agents-block v4 -->
2
2
  ## Next.js docs (version-matched)
3
3
 
4
4
  This site runs **Next.js 16** (the minor is in `package.json`). Before writing Next.js code, read the relevant guide in `node_modules/next/dist/docs/` (in monorepos, resolve from the app that depends on `next`). Keep the managed `<!-- BEGIN:nextjs-agent-rules -->` block in `AGENTS.md`. Do **not** use `npx @next/codemod agents-md`, `.next-docs`, or `NEXT-AGENTS-MD-START` (Next 15 index: Pages Router, `middleware.ts`).
@@ -33,7 +33,7 @@ Before non-trivial code, run the placement checklist (in the skill). Summary:
33
33
  | **Customer shared package** (if monorepo) | Consent/analytics shared across sites in this customer |
34
34
  | **`se-core-product`** (`@se-studio/*`) | Fixes/features needed by 2+ sites, CMS infrastructure |
35
35
 
36
- If the checklist says **core**, stop and emit a **Core request** ([`cross-project-handoff.md`](./cross-project-handoff.md)) — do not patch `@se-studio` behaviour in this repo. Shared converters, Visual/video delivery, cms-edit runtime, sitemap helpers, and site-check assertions belong in core, not a one-site fork. Switch to core-first (or a core session); park the site until npm.
36
+ If the checklist says **core**, stop and emit a **Core request** ([`cross-project-handoff.md`](./cross-project-handoff.md)) — do not patch `@se-studio` behaviour in this repo. File it with `pnpm exec se-agent-guard core-request --from <project_key> --feature <slug> --why "..."` so it is a tracked `from-customer` issue in core, not only a chat message. A PR here that works around core in the meantime links that issue. Shared converters, Visual/video delivery, cms-edit runtime, sitemap helpers, and site-check assertions belong in core, not a one-site fork. Switch to core-first (or a core session); park the site until npm.
37
37
 
38
38
  ### Deploy smoke failed?
39
39
 
@@ -70,12 +70,24 @@ Non-UI changes skip visual gates and go to code review.
70
70
 
71
71
  Before asking to merge to `develop`, run the review in `CODE_REVIEW.md` and stop. Findings: **BLOCKER** / **NIT**. Do not keep a second checklist in `AGENTS.md`. That file only points at `CODE_REVIEW.md`.
72
72
 
73
- One AI review per piece of work, at the end, on the final head SHA. Do not re-review on every push. Lint, typecheck, and tests are CI (the shared site CI workflow). A design review, by someone who did not write the change, is only for schema, forms, analytics, caching, or security. Use skill `architecture-review` and post `## Design review` (PASS / BLOCKERS) as part of that one review.
73
+ The review, design-review triggers and merge steps are in **Review and merge** below. That is the only copy: do not restate it in `.cursor/rules`, `docs/` or another file in this repo.
74
74
 
75
75
  ### Review and merge
76
76
 
77
- 1. **Review.** One review (an agent or a human), when the work is finished. Post it as a PR comment under a heading that says "review", name the **final head SHA** (the full SHA, or a prefix of at least 12 hex characters), and give a verdict (PASS, BLOCKERS, NITs, LGTM or approved). Do not re-review on every push. A later commit that changes schema, forms, analytics, caching, or security gets a review of that delta only. Anything else is CI, and the cited review must still name the current head. A different hex string does not count.
78
- 2. **Approve.** Nick's go in chat is the approval. The agent records it as a PR comment headed `## Merge approval`: who, where, when (Europe/London), the head SHA, and a link to the review comment (`#issuecomment-N` on this PR). Post the review before the approval. Never merge a PR marked **do not merge**.
77
+ 1. **Review.** One review (an agent or a human), when the work is finished. Post it as a PR comment under a heading that says "review", name the **final head SHA** (the full SHA, or a prefix of at least 12 hex characters), and give a verdict (PASS, BLOCKERS, NITs, LGTM or approved). Lint, typecheck and tests are CI (the shared site CI workflow). A change to schema, forms, analytics, caching or security (auth, secrets, headers, access control) also gets a design review in that same review: use skill `architecture-review` and post `## Design review` (PASS / BLOCKERS). Do not re-review on every push. A later commit that changes schema, forms, analytics, caching, or security gets a review of that delta only. Anything else is CI and needs no new code review, but post a one-line `## Review (no code change)` comment at the new head (`PASS at <head SHA, at least 12 hex characters>. Only lint/typecheck/tests/format since <link to earlier review>.`) and link that from the approval. A different hex string does not count.
78
+ 2. **Approve.** Nick's go in chat (or another human the owner has authorised) is the approval; an agent records it but is never the approver. The agent records it as a PR comment headed `## Merge approval`: who, where, when (Europe/London), the head SHA, and a link to the review comment (`#issuecomment-N` on this PR). Post the review before the approval. Never merge a PR marked **do not merge**.
79
+ Template, one comment:
80
+
81
+ ```markdown
82
+ ## Merge approval
83
+ - Who: <name of the person who said go>
84
+ - Where: <chat or agent session, or "GitHub">
85
+ - When: <Europe/London, from `TZ=Europe/London date '+%Y-%m-%d %H:%M %Z'`>
86
+ - Head SHA: <full head SHA>
87
+ - Review: <link to the review comment>
88
+ ```
89
+
90
+ A production promote may use a line that is exactly `CI covers the changes since` instead of the review link; `none, Nick override` or `none, approver override` stands alone on a line. To hold a PR, make it a draft or label it `do not merge`: body prose holds nothing.
79
91
  3. **Check.** `pnpm exec se-agent-guard merge-gate <number>` runs the same gate the Claude hook and the post-merge audit use. Run it before merging; fix what it names.
80
92
  4. **Merge.** `gh pr merge <number> --merge --match-head-commit <approved head sha>`. Merge commits only: never `--squash` or `--rebase`. To undo a merge, `git revert -m 1 <merge commit>`. A merge that skipped the gate is labelled `pushed-through`. That label is the guardrail. It does not start a post-merge AI review.
81
93
  5. **Clean up** (see "Parallel features").
@@ -108,4 +120,4 @@ When **marketing** work is ready, agents **stop** and hand off. Merge `develop`
108
120
 
109
121
  When the promote depends on new/changed Contentful content, complete **release verification** (`release-verification.md` in `@se-studio/skills`): publish state (CDA vs CPA), content smoke (not HTTP-only), preview compare (≥3 pages on published-only build), and no unresolved failed production build. Nick override never skips publish-state or content smoke.
110
122
 
111
- <!-- END:se-core-agents-block v2 -->
123
+ <!-- END:se-core-agents-block v4 -->
@@ -0,0 +1,489 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Fleet consistency audit. Read-only. Reads every registry project from `origin/<integration branch>`
4
+ * (never the local checkout, which is often stale or dirty), plus recent merged PRs via `gh`.
5
+ *
6
+ * node packages/skills/references/agent-session/fleet-audit.mjs [--out report.md] [--prs 20] [--no-prs] [--only om1,hsd]
7
+ *
8
+ * Any agent or human can run it. Output is markdown on stdout (and to --out). It changes nothing.
9
+ * The checks are pure functions (`auditFiles`) so they can be tested without git.
10
+ */
11
+ import { execFileSync } from 'node:child_process';
12
+ import { readFileSync, writeFileSync } from 'node:fs';
13
+ import { homedir } from 'node:os';
14
+ import { dirname, join } from 'node:path';
15
+ import { fileURLToPath } from 'node:url';
16
+
17
+ const here = dirname(fileURLToPath(import.meta.url));
18
+ const repoRoot = join(here, '..', '..', '..', '..');
19
+
20
+ /** First `@se-studio/skills` release that understands the promote line `CI covers the changes since`. */
21
+ export const SKILLS_PROMOTE_LINE_MIN = '1.10.7';
22
+
23
+ /** Compare `1.2.3` style versions; anything unparsable sorts as 0.0.0. */
24
+ export function compareVersions(a, b) {
25
+ const parse = (v) => (String(v).match(/\d+/g) ?? []).slice(0, 3).map(Number);
26
+ const [x, y] = [parse(a), parse(b)];
27
+ for (let i = 0; i < 3; i++) {
28
+ const d = (x[i] ?? 0) - (y[i] ?? 0);
29
+ if (d !== 0) return d < 0 ? -1 : 1;
30
+ }
31
+ return 0;
32
+ }
33
+
34
+ const isExact = (spec) => /^\d+\.\d+\.\d+(?:[-+].*)?$/.test(spec);
35
+ const numeric = (spec) => String(spec).replace(/^[^\d]*/, '');
36
+
37
+ /**
38
+ * @param {{ files: Record<string, string>, coreBlockVersion: number,
39
+ * coreVersions: Record<string, string> }} input
40
+ * files: path -> contents for AGENTS.md, .cursor/rules/*.mdc, docs/*.md, hooks, Claude settings,
41
+ * the merge-gate workflow and every package.json. tree: [{ path, mode }] of tracked files.
42
+ * @returns {{ findings: {id: string, owner: 'core'|'customer', text: string}[],
43
+ * pins: Record<string, {spec: string, where: string}[]> }}
44
+ */
45
+ export function auditFiles({ files, tree = [], coreBlockVersion, coreVersions }) {
46
+ const findings = [];
47
+ const add = (id, owner, text) => findings.push({ id, owner, text });
48
+ /** @type {Record<string, {spec: string, where: string}[]>} */
49
+ const pins = {};
50
+
51
+ for (const [path, body] of Object.entries(files)) {
52
+ if (!path.endsWith('package.json')) continue;
53
+ let pkg;
54
+ try {
55
+ pkg = JSON.parse(body);
56
+ } catch {
57
+ continue;
58
+ }
59
+ for (const group of ['dependencies', 'devDependencies', 'peerDependencies']) {
60
+ for (const [name, spec] of Object.entries(pkg[group] ?? {})) {
61
+ if (!name.startsWith('@se-studio/') || String(spec).startsWith('workspace:')) continue;
62
+ pins[name] = [...(pins[name] ?? []), { spec: String(spec), where: path }];
63
+ }
64
+ }
65
+ for (const [script, cmd] of Object.entries(pkg.scripts ?? {})) {
66
+ if (/skills@latest|skills\s+update/.test(cmd) || script === 'skills:update') {
67
+ add(
68
+ 'skills-update-script',
69
+ 'customer',
70
+ `${path}: script \`${script}\` updates skills outside the lockfile pin`,
71
+ );
72
+ }
73
+ if (script === 'cms-edit:deploy' || /vercel\s+deploy/.test(cmd)) {
74
+ add(
75
+ 'manual-deploy-script',
76
+ 'customer',
77
+ `${path}: script \`${script}\` can deploy production by hand (\`${cmd.slice(0, 60)}\`)`,
78
+ );
79
+ }
80
+ }
81
+ }
82
+
83
+ for (const [name, list] of Object.entries(pins)) {
84
+ const ranges = list.filter((p) => !isExact(p.spec));
85
+ if (ranges.length) {
86
+ add(
87
+ 'pin-not-exact',
88
+ 'customer',
89
+ `${name} is not an exact pin: ${[...new Set(ranges.map((p) => p.spec))].join(', ')} (${ranges[0].where})`,
90
+ );
91
+ }
92
+ }
93
+ for (const p of pins['@se-studio/skills'] ?? []) {
94
+ if (compareVersions(numeric(p.spec), SKILLS_PROMOTE_LINE_MIN) < 0) {
95
+ add(
96
+ 'skills-too-old',
97
+ 'customer',
98
+ `@se-studio/skills ${p.spec} (${p.where}) is older than ${SKILLS_PROMOTE_LINE_MIN}: it rejects a valid production promote that uses \`CI covers the changes since\``,
99
+ );
100
+ }
101
+ }
102
+
103
+ const agents = files['AGENTS.md'];
104
+ if (agents === undefined) {
105
+ add('agents-missing', 'customer', 'AGENTS.md not found');
106
+ } else {
107
+ const v = agents.match(/se-core-agents-block v(\d+)/)?.[1];
108
+ if (!v)
109
+ add(
110
+ 'block-missing',
111
+ 'customer',
112
+ 'AGENTS.md has no `se-core-agents-block` (run "refresh process")',
113
+ );
114
+ else if (Number(v) < coreBlockVersion) {
115
+ add(
116
+ 'block-stale',
117
+ 'customer',
118
+ `AGENTS.md block is v${v}, core is v${coreBlockVersion} (run "refresh process")`,
119
+ );
120
+ }
121
+ }
122
+
123
+ for (const [path, body] of Object.entries(files)) {
124
+ if (
125
+ /^\.cursor\/rules\/.*\.mdc$/.test(path) &&
126
+ /merge approval|CI covers the changes since/i.test(body) &&
127
+ body.split('\n').length > 12
128
+ ) {
129
+ add(
130
+ 'review-rule-restated',
131
+ 'customer',
132
+ `${path} restates the review/merge rules (${body.split('\n').length} lines): replace with a pointer to AGENTS.md`,
133
+ );
134
+ }
135
+ if (
136
+ /^docs\/(merge-approval|design-review|review-before-merge|release-verification)\.md$/.test(
137
+ path,
138
+ )
139
+ ) {
140
+ add(
141
+ 'review-doc-copy',
142
+ 'customer',
143
+ `${path} is a second copy of rules that live in AGENTS.md`,
144
+ );
145
+ }
146
+ if (path.endsWith('.md') || path.endsWith('.mdc')) {
147
+ if (/squash or merge/i.test(body))
148
+ add(
149
+ 'squash-wording',
150
+ 'customer',
151
+ `${path} says "squash or merge": core uses merge commits only`,
152
+ );
153
+ if (/Cursor Projects/.test(body) && /design review/i.test(body)) {
154
+ add(
155
+ 'cursor-projects-wording',
156
+ 'customer',
157
+ `${path} limits design review to Cursor Projects: any agent or human can do it`,
158
+ );
159
+ }
160
+ }
161
+ }
162
+
163
+ for (const [name, list] of Object.entries(pins)) {
164
+ const core = coreVersions[name];
165
+ if (!core) continue;
166
+ for (const p of list) {
167
+ if (isExact(numeric(p.spec)) && compareVersions(numeric(p.spec), core) < 0) {
168
+ // Behind is information, not a failure: sites update on their own schedule.
169
+ add('behind-core', 'customer', `${name} ${p.spec} is behind core ${core} (${p.where})`);
170
+ break;
171
+ }
172
+ }
173
+ }
174
+
175
+ // Process notes may carry old review rules as bullets.
176
+ const notes = files['docs/AGENT_PROCESS_NOTES.md'];
177
+ if (notes && /merge approval|review before merge|re-review|second review/i.test(notes)) {
178
+ add(
179
+ 'process-notes-restate-rules',
180
+ 'customer',
181
+ 'docs/AGENT_PROCESS_NOTES.md carries review/merge rule text: keep site gotchas only and point at AGENTS.md',
182
+ );
183
+ }
184
+
185
+ // Guardrails: the thin files must call the pinned se-agent-guard (see customer-guardrails/README.md).
186
+ const hookFiles = ['.husky/pre-commit', '.githooks/pre-commit']
187
+ .map((f) => files[f])
188
+ .filter(Boolean);
189
+ if (!hookFiles.some((b) => /se-agent-guard\s+commit/.test(b))) {
190
+ add(
191
+ 'hook-commit-missing',
192
+ 'customer',
193
+ 'no pre-commit hook calls `se-agent-guard commit` (.husky/pre-commit or .githooks/pre-commit)',
194
+ );
195
+ }
196
+ const pushFiles = ['.husky/pre-push', '.githooks/pre-push'].map((f) => files[f]).filter(Boolean);
197
+ if (!pushFiles.some((b) => /se-agent-guard\s+push/.test(b))) {
198
+ add(
199
+ 'hook-push-missing',
200
+ 'customer',
201
+ 'no pre-push hook calls `se-agent-guard push` (.husky/pre-push or .githooks/pre-push)',
202
+ );
203
+ }
204
+ if (!/claude-pretool/.test(files['.claude/settings.json'] ?? '')) {
205
+ add(
206
+ 'claude-hook-missing',
207
+ 'customer',
208
+ '.claude/settings.json does not run `claude-pretool.mjs` (copy customer-guardrails/claude-settings.json)',
209
+ );
210
+ }
211
+ if (!/merge-gate/.test(files['.github/workflows/merge-gate-audit.yml'] ?? '')) {
212
+ add(
213
+ 'merge-audit-missing',
214
+ 'customer',
215
+ '.github/workflows/merge-gate-audit.yml is missing or does not call the merge gate: merges that skip approval will not be labelled `pushed-through`',
216
+ );
217
+ }
218
+
219
+ // Skills come from the pinned package via `skills-npm --yes`, not a repo-local sync or `skills update`.
220
+ const rootPkg = files['package.json'] ? safeJson(files['package.json']) : null;
221
+ const prepare = rootPkg?.scripts?.prepare ?? '';
222
+ const legacySync =
223
+ Boolean(rootPkg?.scripts?.['skills:sync']) ||
224
+ tree.some((t) => t.path === 'skills-lock.json' || t.path === 'scripts/sync-skills.sh');
225
+ if (legacySync) {
226
+ add(
227
+ 'skills-sync-legacy',
228
+ 'customer',
229
+ 'repo-local skills sync (`skills:sync`, `scripts/sync-skills.sh` or `skills-lock.json`): move to `skills-npm --yes` in `prepare` and track `skills-npm-lock.json`',
230
+ );
231
+ } else if (rootPkg && !/skills-npm/.test(prepare)) {
232
+ add(
233
+ 'skills-npm-missing',
234
+ 'customer',
235
+ '`prepare` does not run `skills-npm --yes`: skills are not linked from the pinned @se-studio/skills',
236
+ );
237
+ }
238
+ // Whole-directory links and the .agents/skills output are package skills. A per-skill link under
239
+ // .claude/.cursor/.grok is how a repo's own authored skill is exposed, which the README allows.
240
+ const linked = tree.filter(
241
+ (t) =>
242
+ t.mode === '120000' && /^(\.(claude|cursor|grok)\/skills|\.agents\/skills\/.+)$/.test(t.path),
243
+ );
244
+ if (linked.length) {
245
+ add(
246
+ 'skills-links-tracked',
247
+ 'customer',
248
+ `${linked.length} linked skill symlink(s) are tracked (e.g. ${linked[0].path}): untrack and gitignore them`,
249
+ );
250
+ }
251
+
252
+ return { findings, pins };
253
+ }
254
+
255
+ // ---------- git and gh plumbing (not used by tests) ----------
256
+
257
+ const run = (cmd, args, cwd) =>
258
+ execFileSync(cmd, args, {
259
+ cwd,
260
+ encoding: 'utf8',
261
+ stdio: ['ignore', 'pipe', 'pipe'],
262
+ maxBuffer: 64 * 1024 * 1024,
263
+ }).trim();
264
+ const tryRun = (cmd, args, cwd) => {
265
+ try {
266
+ return run(cmd, args, cwd);
267
+ } catch (error) {
268
+ return { error: (error.stderr?.toString() || error.message).split('\n')[0] };
269
+ }
270
+ };
271
+ const expand = (p) => (p.startsWith('~/') ? join(homedir(), p.slice(2)) : p);
272
+
273
+ function readCore() {
274
+ const block = readFileSync(
275
+ join(repoRoot, 'packages/skills/references/agent-session/customer-agents-block.md'),
276
+ 'utf8',
277
+ );
278
+ const coreBlockVersion = Number(block.match(/se-core-agents-block v(\d+)/)?.[1] ?? 0);
279
+ const coreVersions = {};
280
+ for (const dir of [
281
+ 'ab-testing',
282
+ 'cms-seo',
283
+ 'contentful-cms',
284
+ 'contentful-rest-api',
285
+ 'core-data-types',
286
+ 'core-ui',
287
+ 'hubspot',
288
+ 'markdown-renderer',
289
+ 'media-pipeline',
290
+ 'project-build',
291
+ 'search',
292
+ 'site-check',
293
+ 'site-mcp',
294
+ 'site-workflows',
295
+ 'skills',
296
+ ]) {
297
+ try {
298
+ const pkg = JSON.parse(readFileSync(join(repoRoot, 'packages', dir, 'package.json'), 'utf8'));
299
+ coreVersions[pkg.name] = pkg.version;
300
+ } catch {}
301
+ }
302
+ return { coreBlockVersion, coreVersions };
303
+ }
304
+
305
+ function safeJson(text) {
306
+ try {
307
+ return JSON.parse(text);
308
+ } catch {
309
+ return null;
310
+ }
311
+ }
312
+
313
+ function readFromOrigin(path, branch) {
314
+ const ref = `origin/${branch}`;
315
+ const fetched = tryRun('git', ['fetch', '--quiet', 'origin', branch], path);
316
+ if (fetched?.error) return { error: `fetch failed: ${fetched.error}` };
317
+ const raw = tryRun('git', ['ls-tree', '-r', ref], path);
318
+ if (raw?.error) return { error: raw.error };
319
+ // Lines look like "<mode> blob <sha>\t<path>".
320
+ const tree = raw
321
+ .split('\n')
322
+ .filter(Boolean)
323
+ .map((line) => ({
324
+ mode: line.slice(0, line.indexOf(' ')),
325
+ path: line.slice(line.indexOf('\t') + 1),
326
+ }));
327
+ const GUARD_FILES = new Set([
328
+ '.husky/pre-commit',
329
+ '.husky/pre-push',
330
+ '.githooks/pre-commit',
331
+ '.githooks/pre-push',
332
+ '.claude/settings.json',
333
+ '.github/workflows/merge-gate-audit.yml',
334
+ ]);
335
+ const wanted = tree
336
+ .map((t) => t.path)
337
+ .filter((f) => {
338
+ if (GUARD_FILES.has(f)) return true;
339
+ if (f.includes('node_modules/')) return false;
340
+ if (
341
+ f === 'AGENTS.md' ||
342
+ /^\.cursor\/rules\/[^/]+\.mdc$/.test(f) ||
343
+ /^docs\/[^/]+\.md$/.test(f)
344
+ )
345
+ return true;
346
+ return /(^|\/)package\.json$/.test(f) && f.split('/').length <= 4;
347
+ });
348
+ const files = {};
349
+ for (const f of wanted) {
350
+ const body = tryRun('git', ['show', `${ref}:${f}`], path);
351
+ if (typeof body === 'string') files[f] = body;
352
+ }
353
+ return { files, tree };
354
+ }
355
+
356
+ function slugOf(path) {
357
+ const url = tryRun('git', ['remote', 'get-url', 'origin'], path);
358
+ if (typeof url !== 'string') return null;
359
+ return url.replace(/^.*github\.com[:/]/, '').replace(/\.git$/, '');
360
+ }
361
+
362
+ function pushedThrough(slug, count) {
363
+ const out = tryRun(
364
+ 'gh',
365
+ [
366
+ 'pr',
367
+ 'list',
368
+ '-R',
369
+ slug,
370
+ '--state',
371
+ 'merged',
372
+ '--limit',
373
+ String(count),
374
+ '--json',
375
+ 'number,labels,title',
376
+ ],
377
+ undefined,
378
+ );
379
+ if (typeof out !== 'string') return { error: out.error };
380
+ const prs = JSON.parse(out);
381
+ return {
382
+ checked: prs.length,
383
+ breaches: prs
384
+ .filter((p) => p.labels.some((l) => l.name === 'pushed-through'))
385
+ .map((p) => `#${p.number}`),
386
+ };
387
+ }
388
+
389
+ function main() {
390
+ const args = process.argv.slice(2);
391
+ const opt = (name) => {
392
+ const i = args.indexOf(name);
393
+ return i >= 0 ? args[i + 1] : undefined;
394
+ };
395
+ const only = opt('--only')?.split(',');
396
+ const prCount = Number(opt('--prs') ?? 20);
397
+ const registry = JSON.parse(readFileSync(join(here, 'projects.registry.json'), 'utf8'));
398
+ const core = readCore();
399
+ const date = new Date().toISOString().slice(0, 10);
400
+ const out = [
401
+ `# Fleet review ${date}`,
402
+ '',
403
+ `Read from \`origin/<integration branch>\` of each registry project. Core block v${core.coreBlockVersion}. Read-only.`,
404
+ '',
405
+ ];
406
+
407
+ for (const project of registry.projects) {
408
+ if (only && !only.includes(project.key)) continue;
409
+ const path = expand(project.path);
410
+ out.push(`## ${project.key}`);
411
+ const read = readFromOrigin(path, project.branch);
412
+ if (read.error) {
413
+ out.push(
414
+ `- ACCESS NEEDED: could not read \`origin/${project.branch}\` (${read.error}). Not audited.`,
415
+ '',
416
+ );
417
+ continue;
418
+ }
419
+ // Core is the source of the rules, so the customer-copy checks do not apply to it.
420
+ const { findings } =
421
+ project.type === 'core'
422
+ ? { findings: [] }
423
+ : auditFiles({ files: read.files, tree: read.tree, ...core });
424
+ const behind = findings.filter((f) => f.id === 'behind-core');
425
+ const issues = findings.filter((f) => f.id !== 'behind-core');
426
+ if (issues.length === 0)
427
+ out.push(
428
+ project.type === 'core'
429
+ ? '- Source of the rules: customer-copy checks skipped.'
430
+ : '- No policy findings.',
431
+ );
432
+ for (const f of issues) out.push(`- **${f.id}**: ${f.text}`);
433
+ if (behind.length)
434
+ out.push(
435
+ `- _info_ ${behind.length} @se-studio package(s) behind core, e.g. ${behind[0].text}`,
436
+ );
437
+ if (!args.includes('--no-prs')) {
438
+ const slug = slugOf(path);
439
+ const merged = slug ? pushedThrough(slug, prCount) : { error: 'no origin remote' };
440
+ if (merged.error) out.push(`- PRs: could not read (${merged.error})`);
441
+ else if (merged.breaches.length)
442
+ out.push(
443
+ `- **pushed-through**: ${merged.breaches.join(', ')} of the last ${merged.checked} merged PRs skipped the merge gate (history, not necessarily recent)`,
444
+ );
445
+ else
446
+ out.push(
447
+ `- PRs: none of the last ${merged.checked} merged PRs are labelled pushed-through`,
448
+ );
449
+ }
450
+ out.push('');
451
+ }
452
+ const open = tryRun(
453
+ 'gh',
454
+ [
455
+ 'issue',
456
+ 'list',
457
+ '-R',
458
+ 'Something-Else-Studio/se-core-product',
459
+ '--label',
460
+ 'from-customer',
461
+ '--state',
462
+ 'open',
463
+ '--limit',
464
+ '100',
465
+ '--json',
466
+ 'number,title',
467
+ ],
468
+ undefined,
469
+ );
470
+ out.push('## Open Core requests (from-customer)', '');
471
+ if (typeof open !== 'string') out.push(`- could not read (${open.error})`);
472
+ else {
473
+ const issues = JSON.parse(open);
474
+ if (issues.length === 0) out.push('- none open');
475
+ for (const i of issues) out.push(`- #${i.number} ${i.title}`);
476
+ }
477
+ out.push('');
478
+ out.push(
479
+ '## Next',
480
+ '',
481
+ 'Findings with a fix in the customer repo go in a customer PR. Anything that points at core text, the gate or a package belongs in a Core request: `pnpm exec se-agent-guard core-request --from <key> --feature <slug> --why "..."` (see `cross-project-handoff.md`).',
482
+ );
483
+ const text = `${out.join('\n')}\n`;
484
+ const file = opt('--out');
485
+ if (file) writeFileSync(file, text);
486
+ process.stdout.write(text);
487
+ }
488
+
489
+ if (process.argv[1] && join(process.argv[1]) === fileURLToPath(import.meta.url)) main();
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: architecture-review
3
- description: "Review a PR against docs/PHILOSOPHY.md and post a ## Design review with PASS or BLOCKERS. Use only when the diff changes schema, forms, analytics, caching, or security. One review, at the final head SHA. Any agent or human can run it; the author cannot review their own design."
3
+ description: "Review a PR against docs/PHILOSOPHY.md and post a ## Design review with PASS or BLOCKERS. Use only when the diff changes schema, forms, analytics, caching, or security. One review, at the final head SHA. Any agent or human can run it, including the author."
4
4
  ---
5
5
 
6
6
  # Architecture review
@@ -13,7 +13,7 @@ This skill reviews a **PR** at a head SHA. For a proposal that has no PR yet (th
13
13
 
14
14
  ## Who
15
15
 
16
- Any agent or human who did **not** write the change. Check the PR author, the commits' `Co-Authored-By` trailers and the branch history. A fresh session cannot tell whether an earlier session of the same agent wrote it, so if you are unsure, ask.
16
+ Any agent or human, including the one who wrote the change.
17
17
 
18
18
  ## 1. Decide if it applies
19
19
 
@@ -69,7 +69,13 @@ pnpm seo:screaming-frog:fleet -- --list
69
69
  node scripts/screaming-frog-fleet.mjs --install-agent
70
70
  ```
71
71
 
72
- Reports land in `~/spider/fleet-audits/<YYYY-MM-DD>/`. The command does not pass `--tag`, so it does not replace a deployment `content` baseline. `--install-agent` loads a user LaunchAgent (`studio.se.screaming-frog-fleet`) for Sunday 22:00 local time.
72
+ Reports land in `~/spider/fleet-audits/<YYYY-MM-DD>/`. The command does not pass `--tag`, so it does not replace a deployment `content` baseline. After the crawl it writes `delta.md` against the previous dated folder and `brief.md`. The brief uses the xAI API when `XAI_API_KEY` is set, and otherwise repeats the delta.
73
+
74
+ ```bash
75
+ pnpm seo:screaming-frog:fleet -- --delta-only ~/spider/fleet-audits/2026-10-25
76
+ ```
77
+
78
+ `--install-agent` loads a user LaunchAgent (`studio.se.screaming-frog-fleet`) for Sunday 07:00 local time. Install it from the primary `dev` checkout after this script is on `dev`. If `XAI_API_KEY` is set in that shell, the agent plist stores it for the brief. Reinstall only after the code is on `dev`, and point the agent at that checkout.
73
79
 
74
80
  Start URL: the manifest `production` profile. When that profile is a `*.vercel.app` alias and cms-edit `productionSiteUrl` is a public host, the public host is crawled. Eagle stays on its configured Vercel production URL. Preview-only issue downgrades (noindex, preview robots) are not applied.
75
81
 
@@ -102,10 +102,10 @@ Exit code **2** from analyze means errors were found (useful for future CI).
102
102
 
103
103
  ## What counts as an error
104
104
 
105
- Pull uses two CLI passes per target:
105
+ Pull uses two CLI passes per target (Vercel CLI v64+):
106
106
 
107
- - Log level `error` or `fatal`
108
- - HTTP status `500`–`508`
107
+ - `vercel logs runtime --query 'level:(error OR fatal)'` (and `branch:"<branch>"` for develop)
108
+ - `vercel logs requests --query 'httpStatus >= 500 AND httpStatus < 600'`
109
109
 
110
110
  Filter normalizes raw JSON and keeps entries matching:
111
111
 
@@ -123,7 +123,7 @@ Optional: `pnpm vercel-logs:filter --include-warnings`
123
123
  | `vercel logs failed` / auth error | `vercel login` or set `VERCEL_TOKEN` |
124
124
  | Wrong team / project not found | Check `team` in `projects.registry.json`; use `vercel projects ls --scope <team>` |
125
125
  | No targets matched | Check `--sites` / `--envs` keys match registry `key` fields |
126
- | Empty report after errors expected | Widen with `--full` or `--since 7d`; confirm develop uses `--branch develop` |
126
+ | Empty report after errors expected | Widen with `--full` or `--since 7d`; develop queries include `branch:"develop"` |
127
127
 
128
128
  ---
129
129