@su-sws/synthetic-web-team-mcp 0.1.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/README.md +76 -0
- package/bin/sws-mcp.mjs +47 -0
- package/package.json +34 -0
- package/src/scaffold.mjs +106 -0
- package/src/server.mjs +175 -0
- package/src/tools.mjs +283 -0
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @su-sws/synthetic-web-team-mcp
|
|
2
|
+
|
|
3
|
+
MCP server exposing Stanford Web Services standards to any MCP client.
|
|
4
|
+
|
|
5
|
+
**A second entry point, never a requirement.** Everything this server exposes is
|
|
6
|
+
also a plain file under `standards/` that an agent can read directly. If the
|
|
7
|
+
server will not start, nothing else stops working.
|
|
8
|
+
|
|
9
|
+
## Add it to a client
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{ "mcpServers": { "sws": { "command": "npx", "args": ["-y", "@su-sws/synthetic-web-team-mcp"] } } }
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`npx @su-sws/synthetic-web-team init` writes this for you into `.mcp.json` and
|
|
16
|
+
`.cursor/mcp.json`.
|
|
17
|
+
|
|
18
|
+
## Tools
|
|
19
|
+
|
|
20
|
+
| Tool | What it is for |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `sws_get_standard` | Fetch a policy, pattern, recipe, or fragment. Accepts synonyms: `footer`, `wcag`, `sso`, `cookies`, `tokens`. Call with no topic to list everything |
|
|
23
|
+
| `sws_footer_html` | Correct Stanford Global Footer markup, generated from the byte-exact contract |
|
|
24
|
+
| `sws_check` | The advisory compliance report, structured, with a score out of 100 |
|
|
25
|
+
| `sws_decanter_token` | Resolve a Decanter token from the CSS of the version actually installed |
|
|
26
|
+
| `sws_scaffold` | Install the contract, standards and per-site record into a project. **Dry run by default.** Project scope only — the skills install once per machine, outside this tool |
|
|
27
|
+
|
|
28
|
+
Documents are also exposed as resources at `sws://standard/<path>`, for clients
|
|
29
|
+
that support them. Tools are the portable surface; resources are the idiomatic
|
|
30
|
+
one, and supporting both costs almost nothing.
|
|
31
|
+
|
|
32
|
+
### Why `sws_footer_html` exists
|
|
33
|
+
|
|
34
|
+
The Global Footer is immutable, frequently gotten wrong, and mechanically
|
|
35
|
+
generable. This project typed two of its ten URLs wrong from memory in its own
|
|
36
|
+
first draft. Generating from the contract means that cannot happen again.
|
|
37
|
+
|
|
38
|
+
### Why `sws_decanter_token` reads local CSS
|
|
39
|
+
|
|
40
|
+
Decanter 8 is CSS-first, so its tokens are plain custom properties in files we
|
|
41
|
+
can read. The tool parses `node_modules/decanter/src/css/**`, which makes it
|
|
42
|
+
**version-accurate by construction** rather than by staying in sync with a
|
|
43
|
+
separate service. That is also why this project does not depend on
|
|
44
|
+
`decanter-mcp` for v8 work.
|
|
45
|
+
|
|
46
|
+
## Design notes
|
|
47
|
+
|
|
48
|
+
**`sws_check` and `sws_scaffold` shell out** to `@su-sws/sws-cli` and
|
|
49
|
+
`@su-sws/synthetic-web-team` rather than reimplementing them. One implementation
|
|
50
|
+
means the MCP result and the terminal result can never disagree, which is the
|
|
51
|
+
drift this project is organised against. The cost is a process spawn.
|
|
52
|
+
|
|
53
|
+
**Nothing is written to stdout except protocol frames.** stdout *is* the
|
|
54
|
+
transport; a stray `console.log` corrupts the stream and the client reports a
|
|
55
|
+
parse error with no clue where it came from. Diagnostics go to stderr.
|
|
56
|
+
|
|
57
|
+
**Tools never throw.** A thrown error hands the calling model a stack trace,
|
|
58
|
+
which it then tries to reason about. Every failure returns text saying what went
|
|
59
|
+
wrong and what to do about it.
|
|
60
|
+
|
|
61
|
+
## Protocol version
|
|
62
|
+
|
|
63
|
+
Built against the version `@modelcontextprotocol/sdk` negotiates — `2025-11-25`
|
|
64
|
+
latest, down to `2024-11-05`.
|
|
65
|
+
|
|
66
|
+
`PROJECT-PLAN.md` section 7 specified spec `2026-07-28` (stateless,
|
|
67
|
+
`server/discover`). Checked against SDK 1.30.0 on 2026-09-01: that string appears
|
|
68
|
+
nowhere in the SDK, `server/discover` appears nowhere in the SDK, and
|
|
69
|
+
`LATEST_PROTOCOL_VERSION` is `2025-11-25`. Building against a spec no SDK
|
|
70
|
+
implements would have produced a server that works in no editor, which is the
|
|
71
|
+
opposite of this project's portability thesis. Revisit when the SDK ships it; the
|
|
72
|
+
tool surface does not depend on the transport.
|
|
73
|
+
|
|
74
|
+
## Licence
|
|
75
|
+
|
|
76
|
+
GPL-3.0-or-later, matching [Decanter](https://github.com/SU-SWS/decanter).
|
package/bin/sws-mcp.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// stdio entry point. stdio is the transport every MCP client supports, and this
|
|
3
|
+
// server is stateless per call, so nothing here needs a session.
|
|
4
|
+
//
|
|
5
|
+
// NOTHING MAY BE WRITTEN TO STDOUT except protocol frames. stdout IS the
|
|
6
|
+
// transport: a stray console.log corrupts the stream and the client reports a
|
|
7
|
+
// parse error with no clue where it came from. All diagnostics go to stderr.
|
|
8
|
+
|
|
9
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
10
|
+
import { build } from '../src/server.mjs';
|
|
11
|
+
|
|
12
|
+
const args = process.argv.slice(2);
|
|
13
|
+
const flag = (n) => { const i = args.indexOf(n); return i === -1 ? null : args[i + 1]; };
|
|
14
|
+
|
|
15
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
16
|
+
console.error(`
|
|
17
|
+
sws-mcp — Stanford Web Services MCP server (stdio)
|
|
18
|
+
|
|
19
|
+
--root <dir> Default project directory for sws_check and sws_scaffold.
|
|
20
|
+
Defaults to the working directory.
|
|
21
|
+
--standards <dir> Standards directory. Defaults to the copy bundled in @su-sws/synthetic-web-team.
|
|
22
|
+
|
|
23
|
+
Add to an MCP client config:
|
|
24
|
+
|
|
25
|
+
{ "mcpServers": { "sws": { "command": "npx",
|
|
26
|
+
"args": ["-y", "@su-sws/synthetic-web-team-mcp"] } } }
|
|
27
|
+
|
|
28
|
+
Tools: sws_get_standard, sws_footer_html, sws_check, sws_decanter_token,
|
|
29
|
+
sws_scaffold.
|
|
30
|
+
`);
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const { server, index, contentRoot } = build({
|
|
35
|
+
root: flag('--root') ?? process.cwd(),
|
|
36
|
+
standards: flag('--standards') ?? undefined,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
if (!index.length) {
|
|
40
|
+
console.error('sws-mcp: warning — no standards found, so sws_get_standard and');
|
|
41
|
+
console.error('sws_footer_html will report an error. Pass --standards <dir>, or');
|
|
42
|
+
console.error('install @su-sws/synthetic-web-team.');
|
|
43
|
+
} else {
|
|
44
|
+
console.error(`sws-mcp: ${index.length} standards indexed from ${contentRoot ?? 'unknown'}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
await server.connect(new StdioServerTransport());
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@su-sws/synthetic-web-team-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server exposing Stanford Web Services standards, the Global Footer contract, Decanter tokens, and the advisory compliance report to any MCP client.",
|
|
5
|
+
"license": "GPL-3.0-or-later",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"sws-mcp": "./bin/sws-mcp.mjs"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./src/server.mjs"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin",
|
|
15
|
+
"src"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
19
|
+
"@su-sws/synthetic-web-team": "^0.1.0",
|
|
20
|
+
"yaml": "^2.8.1",
|
|
21
|
+
"zod": "^4.1.13"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/SU-SWS/synthetic-web-team.git",
|
|
26
|
+
"directory": "packages/mcp"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22.12.0"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/scaffold.mjs
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// sws_scaffold: drives the wizard programmatically.
|
|
2
|
+
//
|
|
3
|
+
// WHY IT DEFAULTS TO A DRY RUN. This is the only tool here that writes to disk,
|
|
4
|
+
// and it writes about 46 files. A model that calls it speculatively while
|
|
5
|
+
// exploring should get a plan back, not a modified project. So `write` is opt-in
|
|
6
|
+
// and the description says so.
|
|
7
|
+
//
|
|
8
|
+
// It shells out to the wizard binary for the same reason sws_check
|
|
9
|
+
// shells out to the CLI: one implementation, so the MCP path and the terminal
|
|
10
|
+
// path cannot diverge. The wizard is already agent-shaped -- non-interactive off
|
|
11
|
+
// a TTY, `--json`, `--answers`, and it preserves project state on a re-run.
|
|
12
|
+
|
|
13
|
+
import { existsSync } from 'node:fs';
|
|
14
|
+
import { execFileSync } from 'node:child_process';
|
|
15
|
+
import { createRequire } from 'node:module';
|
|
16
|
+
|
|
17
|
+
const ok = (text) => ({ content: [{ type: 'text', text }] });
|
|
18
|
+
const problem = (text) => ({ content: [{ type: 'text', text }], isError: true });
|
|
19
|
+
|
|
20
|
+
function wizardPath() {
|
|
21
|
+
try {
|
|
22
|
+
return createRequire(import.meta.url).resolve('@su-sws/wizard/bin/wizard.mjs');
|
|
23
|
+
} catch {
|
|
24
|
+
const guess = new URL('../../wizard/bin/wizard.mjs', import.meta.url).pathname;
|
|
25
|
+
return existsSync(guess) ? guess : null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function scaffold(defaultRoot, { path, answers, editors, write = false, mode = 'new' } = {}) {
|
|
30
|
+
const bin = wizardPath();
|
|
31
|
+
if (!bin) return problem('Could not locate the wizard. Install @su-sws/synthetic-web-team.');
|
|
32
|
+
|
|
33
|
+
const root = path || defaultRoot;
|
|
34
|
+
if (!existsSync(root)) return problem(`Path does not exist: ${root}`);
|
|
35
|
+
|
|
36
|
+
// The wizard reads positionals as [command, dir], so the command must ALWAYS
|
|
37
|
+
// be present. Passing only the directory made it the command -- which used to
|
|
38
|
+
// fall through to 'new' -- and left the directory undefined, so it planned
|
|
39
|
+
// against the server's working directory instead of the target. The wizard now
|
|
40
|
+
// refuses an unknown command outright, so this would be an error rather than a
|
|
41
|
+
// wrong write, but naming it explicitly is still the correct call. Caught by a dry run that
|
|
42
|
+
// reported the wrong path.
|
|
43
|
+
const args = [bin, mode === 'add' ? 'add' : 'init', root, '--json'];
|
|
44
|
+
if (!write) args.push('--dry-run');
|
|
45
|
+
if (editors) args.push('--editors', Array.isArray(editors) ? editors.join(',') : String(editors));
|
|
46
|
+
if (answers) args.push('--answers', typeof answers === 'string' ? answers : JSON.stringify(answers));
|
|
47
|
+
|
|
48
|
+
let out;
|
|
49
|
+
try {
|
|
50
|
+
out = execFileSync('node', args, { encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 });
|
|
51
|
+
} catch (err) {
|
|
52
|
+
// Exit 2 is bad input and still prints JSON on stdout, so prefer that to the
|
|
53
|
+
// exception message.
|
|
54
|
+
out = (err.stdout || '').toString();
|
|
55
|
+
if (!out.trim()) {
|
|
56
|
+
return problem(`Wizard failed: ${(err.stderr || err.message || '').toString().slice(0, 600)}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let r;
|
|
61
|
+
try { r = JSON.parse(out); }
|
|
62
|
+
catch { return problem(`Wizard returned output that is not JSON:\n${out.slice(0, 600)}`); }
|
|
63
|
+
|
|
64
|
+
if (!r.ok) {
|
|
65
|
+
return problem(`Wizard rejected the request: ${r.error}${r.detail ? `\n${r.detail}` : ''}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const c = r.counts;
|
|
69
|
+
const head = r.written
|
|
70
|
+
? (c.created === 0 && c.updated === 0
|
|
71
|
+
? `Already installed in ${r.root}. ${c.unchanged + (c.preserved ?? 0)} files, nothing to change.`
|
|
72
|
+
: `Installed into ${r.root}. ${c.created} created, ${c.updated} updated, ${c.unchanged} unchanged` +
|
|
73
|
+
(c.preserved ? `, ${c.preserved} preserved` : '') + '.')
|
|
74
|
+
: `DRY RUN. Nothing was written. ${c.files} files would be installed into ${r.root}.`;
|
|
75
|
+
|
|
76
|
+
const parts = [head, ''];
|
|
77
|
+
|
|
78
|
+
parts.push(`Compliance tier: **${r.tier.tier}** — ${r.tier.because}`);
|
|
79
|
+
if (r.tier.tier !== 'low') {
|
|
80
|
+
parts.push(`This is above a basic static site. A Data Risk Assessment may be required`,
|
|
81
|
+
`before deploy. See standards/policy/privacy.md and route via`,
|
|
82
|
+
`standards/policy/escalation.md.`);
|
|
83
|
+
}
|
|
84
|
+
parts.push('');
|
|
85
|
+
|
|
86
|
+
if (r.incomplete?.length) {
|
|
87
|
+
parts.push(`## Placeholders, not answers`,
|
|
88
|
+
`These fields in .sws/manifest.yml are unfilled:`,
|
|
89
|
+
...r.incomplete.map((f) => `- ${f}`),
|
|
90
|
+
``,
|
|
91
|
+
`**Ask the user for these. Do not invent them.** MinWeb requires a named`,
|
|
92
|
+
`business owner and technical administrator, both with valid Stanford email.`,
|
|
93
|
+
`Re-run with \`answers\` to record them; the manifest is preserved on re-runs,`,
|
|
94
|
+
`so editing it directly is also fine.`,
|
|
95
|
+
``);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
parts.push(`## Next`, ...r.next.map((n) =>
|
|
99
|
+
`- **${n.kind}**${n.path ? ` \`${n.path}\`` : ''}${n.command ? ` \`${n.command}\`` : ''}` +
|
|
100
|
+
`${n.skill ? ` skill \`${n.skill}\`` : ''}\n ${n.why}`));
|
|
101
|
+
|
|
102
|
+
if (!r.written) {
|
|
103
|
+
parts.push('', `To apply this, call again with \`write: true\`.`);
|
|
104
|
+
}
|
|
105
|
+
return ok(parts.join('\n'));
|
|
106
|
+
}
|
package/src/server.mjs
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// The MCP server: a second entry point for agents, never a requirement.
|
|
2
|
+
//
|
|
3
|
+
// PROTOCOL VERSION, AND A DIVERGENCE FROM THE PLAN.
|
|
4
|
+
//
|
|
5
|
+
// PROJECT-PLAN.md section 7 specifies "spec 2026-07-28 (stateless,
|
|
6
|
+
// server/discover, Streamable HTTP plus stdio)". Checked against
|
|
7
|
+
// @modelcontextprotocol/sdk 1.30.0 on 2026-09-01:
|
|
8
|
+
//
|
|
9
|
+
// LATEST_PROTOCOL_VERSION 2025-11-25
|
|
10
|
+
// SUPPORTED_PROTOCOL_VERSIONS 2025-11-25, 2025-06-18, 2025-03-26,
|
|
11
|
+
// 2024-11-05, 2024-10-07
|
|
12
|
+
// "2026-07-28" appears nowhere in the SDK
|
|
13
|
+
// "server/discover" appears nowhere in the SDK
|
|
14
|
+
//
|
|
15
|
+
// So the plan named a spec that the official SDK does not implement, and
|
|
16
|
+
// therefore that real clients almost certainly do not speak. Building against it
|
|
17
|
+
// would have produced a server that works in no editor -- the opposite of this
|
|
18
|
+
// project's whole portability thesis. We build against the SDK's negotiated
|
|
19
|
+
// version instead, which is what Claude Code, Cursor and the rest are tested
|
|
20
|
+
// against. Revisit if and when the SDK ships 2026-07-28; the tool surface below
|
|
21
|
+
// does not depend on the transport.
|
|
22
|
+
//
|
|
23
|
+
// Using the SDK rather than hand-rolling JSON-RPC is also deliberate, and it is
|
|
24
|
+
// a real trade. It brings roughly fifteen transitive dependencies for a
|
|
25
|
+
// stdio-only server, and every dependency is a MinSec patching obligation this
|
|
26
|
+
// project takes seriously. It wins anyway because protocol correctness in real
|
|
27
|
+
// clients is the one thing that cannot be verified from here, and the SDK is
|
|
28
|
+
// what those clients are tested against. Hand-rolling becomes reasonable once
|
|
29
|
+
// the protocol stops moving.
|
|
30
|
+
|
|
31
|
+
import { readFileSync } from 'node:fs';
|
|
32
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
33
|
+
import { z } from 'zod';
|
|
34
|
+
import { createRequire } from 'node:module';
|
|
35
|
+
import { existsSync } from 'node:fs';
|
|
36
|
+
import { dirname, join } from 'node:path';
|
|
37
|
+
import { indexStandards, getStandard, footerHtml, check, decanterToken } from './tools.mjs';
|
|
38
|
+
import { scaffold } from './scaffold.mjs';
|
|
39
|
+
|
|
40
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
41
|
+
|
|
42
|
+
// Standards ship inside @su-sws/synthetic-web-team. Resolve that package, then fall back to the
|
|
43
|
+
// repository layout so this works from a checkout with no install.
|
|
44
|
+
const bundledStandards = (() => {
|
|
45
|
+
try {
|
|
46
|
+
const p = createRequire(import.meta.url).resolve('@su-sws/synthetic-web-team/package.json');
|
|
47
|
+
const c = join(dirname(p), 'standards');
|
|
48
|
+
if (existsSync(c)) return c;
|
|
49
|
+
} catch { /* not installed */ }
|
|
50
|
+
const dev = new URL('../../../standards', import.meta.url).pathname;
|
|
51
|
+
return existsSync(dev) ? dev : null;
|
|
52
|
+
})();
|
|
53
|
+
|
|
54
|
+
export function build({ root = process.cwd(), standards = bundledStandards } = {}) {
|
|
55
|
+
const server = new McpServer(
|
|
56
|
+
{ name: 'sws', version: pkg.version },
|
|
57
|
+
{
|
|
58
|
+
instructions: [
|
|
59
|
+
'Stanford Web Services standards for building Stanford websites.',
|
|
60
|
+
'',
|
|
61
|
+
'Read the behavioral contract first: call sws_get_standard with no topic to',
|
|
62
|
+
'list everything, or fetch AGENTS.md from the project if it is installed.',
|
|
63
|
+
'',
|
|
64
|
+
'Three rules that govern every answer you give from these tools:',
|
|
65
|
+
'- Everything is advisory except committed credentials. Report findings,',
|
|
66
|
+
' explain the policy, offer a fix, and move on. Do not block or lecture.',
|
|
67
|
+
'- Automated accessibility testing covers roughly 30% of issues per ODA',
|
|
68
|
+
' guidance. Never call a site accessible on the strength of a passing check.',
|
|
69
|
+
'- You cannot grant an exception, approve a subdomain, sign off a launch, or',
|
|
70
|
+
' interpret Stanford policy. Name the responsible office and stop.',
|
|
71
|
+
].join('\n'),
|
|
72
|
+
},
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const index = indexStandards(standards);
|
|
76
|
+
|
|
77
|
+
// ---- documents ---------------------------------------------------------
|
|
78
|
+
|
|
79
|
+
server.registerTool('sws_get_standard', {
|
|
80
|
+
title: 'Get a Stanford standard',
|
|
81
|
+
description:
|
|
82
|
+
'Fetch a Stanford Web Services standard: policy (MinWeb, MinSec, accessibility, ' +
|
|
83
|
+
'privacy, brand, identity, procurement, escalation), patterns (Decanter, components, ' +
|
|
84
|
+
'content, IA, forms, discoverability), a build recipe, or a normative fragment. ' +
|
|
85
|
+
'Call with no topic to list every available topic. Accepts common synonyms such as ' +
|
|
86
|
+
'"footer", "wcag", "sso", "cookies", "tokens".',
|
|
87
|
+
inputSchema: { topic: z.string().optional().describe('Topic or path, e.g. "minweb", "accessibility", "footer", "astro-static". Omit to list all.') },
|
|
88
|
+
}, async ({ topic }) => getStandard(index, topic));
|
|
89
|
+
|
|
90
|
+
// Resources too, for clients that support them. Same content, addressed as
|
|
91
|
+
// sws://standard/<path>. Tools are the portable surface; resources are the
|
|
92
|
+
// idiomatic one, and supporting both costs almost nothing.
|
|
93
|
+
for (const entry of index) {
|
|
94
|
+
server.registerResource(
|
|
95
|
+
entry.path, `sws://standard/${entry.path}`,
|
|
96
|
+
{ title: entry.path, description: `Stanford ${entry.area} standard`, mimeType: entry.path.endsWith('.md') ? 'text/markdown' : 'application/yaml' },
|
|
97
|
+
async () => ({ contents: [{ uri: `sws://standard/${entry.path}`, text: readFileSync(entry.abs, 'utf8') }] }),
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ---- the footer, which justifies the server on its own -----------------
|
|
102
|
+
|
|
103
|
+
server.registerTool('sws_footer_html', {
|
|
104
|
+
title: 'Stanford Global Footer markup',
|
|
105
|
+
description:
|
|
106
|
+
'Return correct, current Stanford Global Footer HTML, generated from the byte-exact ' +
|
|
107
|
+
'contract rather than from memory. The footer is immutable: its links may not be ' +
|
|
108
|
+
'altered, reordered, or added to. Use this instead of writing footer markup yourself — ' +
|
|
109
|
+
'two of its ten URLs are commonly gotten wrong.',
|
|
110
|
+
inputSchema: { unit: z.string().optional().describe('Unit name, only so the response can tell you where unit links actually belong. The Global Footer takes no unit content.') },
|
|
111
|
+
}, async ({ unit }) => footerHtml(standards, { unit }));
|
|
112
|
+
|
|
113
|
+
// ---- the advisory report ----------------------------------------------
|
|
114
|
+
|
|
115
|
+
server.registerTool('sws_check', {
|
|
116
|
+
title: 'Run the Stanford compliance report',
|
|
117
|
+
description:
|
|
118
|
+
'Run the advisory compliance checks against a project and return structured findings ' +
|
|
119
|
+
'with a score out of 100. Covers the Global Footer, Identity Bar, Decanter 8, ' +
|
|
120
|
+
'accessibility, SEO, MinWeb ownership, secrets, and the performance budget. ' +
|
|
121
|
+
'Never fails: a check that cannot run reports "unknown" and withholds its points ' +
|
|
122
|
+
'rather than passing. Build the site first, and run sws a11y and sws perf, for a ' +
|
|
123
|
+
'complete result.',
|
|
124
|
+
inputSchema: {
|
|
125
|
+
path: z.string().optional().describe('Project directory. Defaults to the server working directory.'),
|
|
126
|
+
standards: z.string().optional().describe('Standards directory, if the project does not vendor one.'),
|
|
127
|
+
},
|
|
128
|
+
}, async ({ path, standards: std }) => check(root, { path, standards: std }));
|
|
129
|
+
|
|
130
|
+
// ---- Decanter tokens, read from the installed package ------------------
|
|
131
|
+
|
|
132
|
+
server.registerTool('sws_decanter_token', {
|
|
133
|
+
title: 'Resolve a Decanter token',
|
|
134
|
+
description:
|
|
135
|
+
'Look up Decanter design tokens by name or value, read from the CSS of the Decanter ' +
|
|
136
|
+
'actually installed in the project — so the answer matches the version in use rather ' +
|
|
137
|
+
'than documentation that may describe v7. Query colours ("cardinal"), spacing, type, ' +
|
|
138
|
+
'breakpoints, or a hex value to find which token defines it.',
|
|
139
|
+
inputSchema: {
|
|
140
|
+
query: z.string().optional().describe('Token fragment or value, e.g. "cardinal", "fog", "#8C1515", "font-size".'),
|
|
141
|
+
path: z.string().optional().describe('Project directory containing node_modules/decanter.'),
|
|
142
|
+
},
|
|
143
|
+
}, async ({ query, path }) => decanterToken(root, { query, path }));
|
|
144
|
+
|
|
145
|
+
// ---- scaffolding, dry by default --------------------------------------
|
|
146
|
+
|
|
147
|
+
server.registerTool('sws_scaffold', {
|
|
148
|
+
title: 'Install the Stanford agent team into a project',
|
|
149
|
+
description:
|
|
150
|
+
'Install the behavioral contract, the standards, and the per-site record into a project, ' +
|
|
151
|
+
'and derive its compliance tier. DEFAULTS TO A DRY RUN: pass write=true to actually ' +
|
|
152
|
+
'write files. Re-running is safe — .sws/manifest.yml and .sws/acknowledged.yml are ' +
|
|
153
|
+
'project state and are preserved. Supply answers so the manifest records real values ' +
|
|
154
|
+
'instead of placeholders. This is PROJECT scope only: the role skills install once per ' +
|
|
155
|
+
'machine via `npx @su-sws/synthetic-web-team install`, so a project holding no skills is ' +
|
|
156
|
+
'correct rather than a failed install.',
|
|
157
|
+
inputSchema: {
|
|
158
|
+
path: z.string().optional().describe('Target project directory. Defaults to the server working directory.'),
|
|
159
|
+
write: z.boolean().optional().describe('false (default) reports the plan; true writes the files.'),
|
|
160
|
+
mode: z.enum(['init', 'add', 'new']).optional().describe('"init" for a new site (default), "add" for an existing project. "new" is accepted as an alias for "init".'),
|
|
161
|
+
editors: z.array(z.string()).optional().describe('Editor ids, e.g. ["claude-code","cursor"]. Omit to auto-detect.'),
|
|
162
|
+
answers: z.object({
|
|
163
|
+
siteName: z.string().optional(), unit: z.string().optional(),
|
|
164
|
+
purpose: z.string().optional(), url: z.string().optional(),
|
|
165
|
+
recipe: z.string().optional(),
|
|
166
|
+
businessOwnerName: z.string().optional(), businessOwnerEmail: z.string().optional(),
|
|
167
|
+
techAdminName: z.string().optional(), techAdminEmail: z.string().optional(),
|
|
168
|
+
collectsPersonalData: z.boolean().optional(), authenticates: z.boolean().optional(),
|
|
169
|
+
payments: z.boolean().optional(), regulated: z.boolean().optional(),
|
|
170
|
+
}).optional().describe('Project facts. The four booleans derive the compliance tier. Ask the user for owner names and emails; never invent them.'),
|
|
171
|
+
},
|
|
172
|
+
}, async (args) => scaffold(root, args));
|
|
173
|
+
|
|
174
|
+
return { server, index, contentRoot: standards };
|
|
175
|
+
}
|
package/src/tools.mjs
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
// The tools. Each one exists because an agent gets it wrong or gets it slowly
|
|
2
|
+
// by reading files, not merely because it could be exposed.
|
|
3
|
+
//
|
|
4
|
+
// Every handler returns text content and never throws: an MCP tool that throws
|
|
5
|
+
// gives the calling model a stack trace, which it then tries to reason about. A
|
|
6
|
+
// structured "here is what went wrong and what to do" is always more useful.
|
|
7
|
+
|
|
8
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
9
|
+
import { join, relative, extname } from 'node:path';
|
|
10
|
+
import { execFileSync } from 'node:child_process';
|
|
11
|
+
import { createRequire } from 'node:module';
|
|
12
|
+
import YAML from 'yaml';
|
|
13
|
+
|
|
14
|
+
const ok = (text) => ({ content: [{ type: 'text', text }] });
|
|
15
|
+
const problem = (text) => ({ content: [{ type: 'text', text }], isError: true });
|
|
16
|
+
|
|
17
|
+
// --------------------------------------------------------------------------
|
|
18
|
+
// sws_get_standard
|
|
19
|
+
// --------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
/** Every L0 document, as { key, path, title }. Built once at startup. */
|
|
22
|
+
export function indexStandards(standardsDir) {
|
|
23
|
+
if (!standardsDir || !existsSync(standardsDir)) return [];
|
|
24
|
+
const out = [];
|
|
25
|
+
(function walk(d) {
|
|
26
|
+
for (const name of readdirSync(d)) {
|
|
27
|
+
const p = join(d, name);
|
|
28
|
+
if (statSync(p).isDirectory()) { walk(p); continue; }
|
|
29
|
+
if (!['.md', '.yml', '.yaml'].includes(extname(name))) continue;
|
|
30
|
+
const rel = relative(standardsDir, p).split(/[\\/]/).join('/');
|
|
31
|
+
out.push({
|
|
32
|
+
// "policy/minweb.md" -> "minweb"; "recipes/astro-static/RECIPE.md"
|
|
33
|
+
// -> "astro-static". The key is what an agent would actually type.
|
|
34
|
+
key: rel.replace(/\.(md|ya?ml)$/, '').split('/').filter((s) => !/^(RECIPE|README|INDEX)$/i.test(s)).pop(),
|
|
35
|
+
area: rel.split('/')[0],
|
|
36
|
+
path: rel,
|
|
37
|
+
abs: p,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
})(standardsDir);
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Words an agent is likely to use that are not the filename. Kept small and
|
|
45
|
+
// explicit: a fuzzy matcher that guesses wrong is worse than one that says
|
|
46
|
+
// "did you mean" and lists the options.
|
|
47
|
+
const ALIASES = {
|
|
48
|
+
footer: 'global-footer', 'global footer': 'global-footer',
|
|
49
|
+
'identity bar': 'brand', logo: 'brand', colour: 'brand', color: 'brand',
|
|
50
|
+
typography: 'brand', font: 'brand', fonts: 'brand',
|
|
51
|
+
a11y: 'accessibility', wcag: 'accessibility', axe: 'accessibility',
|
|
52
|
+
siteimprove: 'accessibility', oda: 'accessibility',
|
|
53
|
+
security: 'minsec', tier: 'minsec', patching: 'minsec',
|
|
54
|
+
minweb: 'minweb', secrets: 'minweb', https: 'minweb', owner: 'minweb',
|
|
55
|
+
privacy: 'privacy', minpriv: 'privacy', cookies: 'privacy', cookie: 'privacy',
|
|
56
|
+
dra: 'privacy', consent: 'privacy',
|
|
57
|
+
auth: 'identity', sso: 'identity', saml: 'identity', oidc: 'identity',
|
|
58
|
+
login: 'identity', weblogin: 'identity',
|
|
59
|
+
vpat: 'procurement', acr: 'procurement',
|
|
60
|
+
tailwind: 'decanter', css: 'decanter', tokens: 'decanter',
|
|
61
|
+
seo: 'discoverability', geo: 'discoverability', llms: 'discoverability',
|
|
62
|
+
forms: 'forms', form: 'forms',
|
|
63
|
+
ia: 'ia', sitemap: 'ia', urls: 'ia', navigation: 'ia', redirects: 'ia',
|
|
64
|
+
content: 'content', voice: 'content', 'alt text': 'content',
|
|
65
|
+
components: 'components', storybook: 'components',
|
|
66
|
+
escalation: 'escalation', office: 'escalation', 'who do i ask': 'escalation',
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export function getStandard(index, topic) {
|
|
70
|
+
if (!index.length) return problem('No standards directory is available to this server.');
|
|
71
|
+
const q = String(topic ?? '').trim().toLowerCase();
|
|
72
|
+
if (!q) {
|
|
73
|
+
return ok(`Topics available:\n${index.map((e) => ` ${e.key} (${e.path})`).join('\n')}`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const wanted = ALIASES[q] ?? q;
|
|
77
|
+
const exact = index.find((e) => e.key.toLowerCase() === wanted)
|
|
78
|
+
?? index.find((e) => e.path.toLowerCase() === wanted);
|
|
79
|
+
const hit = exact ?? index.find((e) => e.key.toLowerCase().includes(wanted))
|
|
80
|
+
?? index.find((e) => e.path.toLowerCase().includes(wanted));
|
|
81
|
+
|
|
82
|
+
if (!hit) {
|
|
83
|
+
const near = index.filter((e) => e.key.toLowerCase().includes(wanted.slice(0, 4))).slice(0, 6);
|
|
84
|
+
return problem(`No standard matches "${topic}".` +
|
|
85
|
+
(near.length ? `\n\nDid you mean:\n${near.map((e) => ` ${e.key}`).join('\n')}` : '') +
|
|
86
|
+
`\n\nCall with no topic to list everything.`);
|
|
87
|
+
}
|
|
88
|
+
return ok(`# ${hit.path}\n\n${readFileSync(hit.abs, 'utf8')}`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// --------------------------------------------------------------------------
|
|
92
|
+
// sws_footer_html
|
|
93
|
+
//
|
|
94
|
+
// The tool the plan says justifies the server on its own. The Global Footer is
|
|
95
|
+
// immutable, frequently gotten wrong, and mechanically generable -- and this
|
|
96
|
+
// project typed two of its ten URLs wrong from memory in its own first draft.
|
|
97
|
+
// Generating from the contract means that cannot happen again.
|
|
98
|
+
// --------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
export function footerHtml(standardsDir, { unit } = {}) {
|
|
101
|
+
const p = standardsDir && join(standardsDir, 'fragments', 'global-footer.yml');
|
|
102
|
+
if (!p || !existsSync(p)) return problem(`Footer contract not found at ${p ?? 'standards/fragments/global-footer.yml'}.`);
|
|
103
|
+
|
|
104
|
+
let c;
|
|
105
|
+
try { c = YAML.parse(readFileSync(p, 'utf8')); }
|
|
106
|
+
catch (err) { return problem(`Footer contract is not valid YAML: ${err.message}`); }
|
|
107
|
+
|
|
108
|
+
const esc = (s) => String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
109
|
+
const li = (l) => ` <li><a href="${esc(l.href)}"${l.title ? ` title="${esc(l.title)}"` : ''}>${esc(l.label)}</a></li>`;
|
|
110
|
+
|
|
111
|
+
const html = `<footer>
|
|
112
|
+
<nav aria-label="${esc(c.structure?.nav?.aria_label ?? 'global footer menu')}">
|
|
113
|
+
<ul>
|
|
114
|
+
${c.resource_links.map(li).join('\n')}
|
|
115
|
+
</ul>
|
|
116
|
+
<ul>
|
|
117
|
+
${c.policy_links.map(li).join('\n')}
|
|
118
|
+
</ul>
|
|
119
|
+
</nav>
|
|
120
|
+
${(c.copyright?.lines ?? []).map((l) => ` <span>${esc(l)}</span>`).join('\n')}
|
|
121
|
+
</footer>`;
|
|
122
|
+
|
|
123
|
+
const notes = [
|
|
124
|
+
`Generated from standards/fragments/global-footer.yml (extracted ${c.extracted ?? 'unknown date'}).`,
|
|
125
|
+
'',
|
|
126
|
+
'RULES THAT APPLY TO THIS MARKUP:',
|
|
127
|
+
'- Immutable. Do not alter, reorder, or add links, and put nothing else inside it.',
|
|
128
|
+
'- The links are TWO lists inside ONE nav, not one list of ten. A check written',
|
|
129
|
+
' against a flat list produces false failures on correct markup.',
|
|
130
|
+
'- Unit links belong in a LOCAL footer ABOVE this one. Putting them inside is the',
|
|
131
|
+
' single most common Stanford brand violation.',
|
|
132
|
+
'- Decanter 8 supplies the styling. Add classes from it; do not hand-write brand CSS.',
|
|
133
|
+
];
|
|
134
|
+
if (unit) {
|
|
135
|
+
notes.push('', `You passed unit "${unit}". The Global Footer takes no unit content —`,
|
|
136
|
+
`put "${unit}" links in a local footer above it.`);
|
|
137
|
+
}
|
|
138
|
+
return ok(`${html}\n\n<!--\n${notes.join('\n')}\n-->`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// --------------------------------------------------------------------------
|
|
142
|
+
// sws_check
|
|
143
|
+
//
|
|
144
|
+
// Shells out to the sws CLI rather than reimplementing the checks.
|
|
145
|
+
// Deliberate: running the same binary a human runs means the MCP result and the
|
|
146
|
+
// terminal result can never disagree, which is the drift this project is
|
|
147
|
+
// organised against. The cost is one process spawn, which is nothing next to
|
|
148
|
+
// two implementations of a compliance score.
|
|
149
|
+
// --------------------------------------------------------------------------
|
|
150
|
+
|
|
151
|
+
function cliPath() {
|
|
152
|
+
try {
|
|
153
|
+
const req = createRequire(import.meta.url);
|
|
154
|
+
return req.resolve('@su-sws/sws-cli/bin/sws.mjs');
|
|
155
|
+
} catch {
|
|
156
|
+
// Workspace layout, when exports are not resolvable from here.
|
|
157
|
+
const guess = new URL('../../cli/bin/sws.mjs', import.meta.url).pathname;
|
|
158
|
+
return existsSync(guess) ? guess : null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function check(defaultRoot, { path, standards } = {}) {
|
|
163
|
+
const bin = cliPath();
|
|
164
|
+
if (!bin) return problem('Could not locate the sws CLI. Install @su-sws/sws-cli.');
|
|
165
|
+
const cwd = path ? path : defaultRoot;
|
|
166
|
+
if (!existsSync(cwd)) return problem(`Path does not exist: ${cwd}`);
|
|
167
|
+
|
|
168
|
+
const args = ['doctor', '--format', 'json', '--no-publish', '--no-summary'];
|
|
169
|
+
if (standards) args.push('--standards', standards);
|
|
170
|
+
|
|
171
|
+
let out;
|
|
172
|
+
try {
|
|
173
|
+
// `doctor`, not `check`: doctor always exits 0, so a compliance finding can
|
|
174
|
+
// never look like a tool failure to the model.
|
|
175
|
+
out = execFileSync('node', [bin, ...args], {
|
|
176
|
+
cwd, encoding: 'utf8', maxBuffer: 32 * 1024 * 1024,
|
|
177
|
+
env: { ...process.env, NO_COLOR: '1' },
|
|
178
|
+
});
|
|
179
|
+
} catch (err) {
|
|
180
|
+
return problem(`sws could not run in ${cwd}: ${(err.stderr || err.message || '').toString().slice(0, 600)}`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
let r;
|
|
184
|
+
try { r = JSON.parse(out); }
|
|
185
|
+
catch { return problem(`sws returned output that is not JSON:\n${out.slice(0, 600)}`); }
|
|
186
|
+
|
|
187
|
+
const by = (s) => r.findings.filter((f) => f.state === s);
|
|
188
|
+
const line = (f) => `- ${f.id}${f.weight ? ` (${f.weight}pt)` : ''}: ${f.detail}${f.fix ? `\n fix: ${f.fix}` : ''}`;
|
|
189
|
+
|
|
190
|
+
const parts = [
|
|
191
|
+
`# Compliance report: ${r.score.value}/100`,
|
|
192
|
+
``,
|
|
193
|
+
`Recipe \`${r.recipe}\` in ${cwd}`,
|
|
194
|
+
`${r.counts.pass} passing, ${r.counts.fail} to fix, ${r.counts.unknown} unchecked` +
|
|
195
|
+
(r.counts.acknowledged ? `, ${r.counts.acknowledged} accepted` : ''),
|
|
196
|
+
``,
|
|
197
|
+
];
|
|
198
|
+
if (by('fail').length) parts.push(`## To fix\n${by('fail').map(line).join('\n')}\n`);
|
|
199
|
+
if (by('unknown').length) parts.push(`## Could not check\n${by('unknown').map(line).join('\n')}\n`);
|
|
200
|
+
if (by('acknowledged').length) parts.push(`## Accepted risks\n${by('acknowledged').map(line).join('\n')}\n`);
|
|
201
|
+
|
|
202
|
+
parts.push(
|
|
203
|
+
`## How to read this`,
|
|
204
|
+
`Everything is advisory except \`minweb.no-secrets\`, which is the only finding`,
|
|
205
|
+
`that fails a build. "Could not check" is never a pass: those points are`,
|
|
206
|
+
`withheld. Run \`sws a11y\` and \`sws perf\` after a build to convert the axe,`,
|
|
207
|
+
`interactive-state, and performance criteria from unchecked into real results.`,
|
|
208
|
+
``,
|
|
209
|
+
`Automated checks cover roughly 30% of accessibility issues per ODA guidance.`,
|
|
210
|
+
`A passing report is a floor, not a conformance claim. Never tell a user their`,
|
|
211
|
+
`site is accessible on the strength of this.`,
|
|
212
|
+
``,
|
|
213
|
+
`<details><summary>Raw JSON</summary>\n\n\`\`\`json\n${JSON.stringify(r, null, 2)}\n\`\`\`\n</details>`,
|
|
214
|
+
);
|
|
215
|
+
return ok(parts.join('\n'));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// --------------------------------------------------------------------------
|
|
219
|
+
// sws_decanter_token
|
|
220
|
+
//
|
|
221
|
+
// Reads the INSTALLED package's own CSS, so it is version-accurate by
|
|
222
|
+
// construction rather than by staying in sync with a separate service. This is
|
|
223
|
+
// why the project does not depend on decanter-mcp for v8 work.
|
|
224
|
+
// --------------------------------------------------------------------------
|
|
225
|
+
|
|
226
|
+
export function decanterToken(defaultRoot, { query, path } = {}) {
|
|
227
|
+
const root = path || defaultRoot;
|
|
228
|
+
const dir = join(root, 'node_modules', 'decanter', 'src', 'css');
|
|
229
|
+
if (!existsSync(dir)) {
|
|
230
|
+
return problem(
|
|
231
|
+
`Decanter is not installed under ${root}.\n\n` +
|
|
232
|
+
`Install it first: npm i decanter@beta (checked 2026-09-01: dist-tag \`latest\` is 7.5.3, ` +
|
|
233
|
+
`so a bare \`npm i decanter\` gets v7, which is a Tailwind 3 JS preset and architecturally ` +
|
|
234
|
+
`different from v8. See standards/patterns/decanter.md.)`);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
let version = 'unknown';
|
|
238
|
+
try {
|
|
239
|
+
version = JSON.parse(readFileSync(join(root, 'node_modules', 'decanter', 'package.json'), 'utf8')).version;
|
|
240
|
+
} catch { /* keep going: the CSS is what matters */ }
|
|
241
|
+
|
|
242
|
+
// Custom properties, with the file they came from so an agent can cite it.
|
|
243
|
+
const tokens = [];
|
|
244
|
+
(function walk(d) {
|
|
245
|
+
for (const name of readdirSync(d)) {
|
|
246
|
+
const p = join(d, name);
|
|
247
|
+
if (statSync(p).isDirectory()) { walk(p); continue; }
|
|
248
|
+
if (extname(name) !== '.css') continue;
|
|
249
|
+
const rel = relative(dir, p).split(/[\\/]/).join('/');
|
|
250
|
+
for (const m of readFileSync(p, 'utf8').matchAll(/(--[a-z0-9-]+)\s*:\s*([^;}]+)/gi)) {
|
|
251
|
+
tokens.push({ name: m[1], value: m[2].trim().replace(/\s+/g, ' '), file: rel });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
})(dir);
|
|
255
|
+
|
|
256
|
+
if (!tokens.length) return problem(`No custom properties found under ${dir}.`);
|
|
257
|
+
|
|
258
|
+
const q = String(query ?? '').trim().toLowerCase();
|
|
259
|
+
const hits = q
|
|
260
|
+
? tokens.filter((t) => t.name.toLowerCase().includes(q) || t.value.toLowerCase().includes(q))
|
|
261
|
+
: tokens;
|
|
262
|
+
|
|
263
|
+
if (!hits.length) {
|
|
264
|
+
const areas = [...new Set(tokens.map((t) => t.file))].sort();
|
|
265
|
+
return problem(`No Decanter token matches "${query}" in ${version}.\n\nFiles searched:\n` +
|
|
266
|
+
areas.map((a) => ` ${a}`).join('\n'));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const shown = hits.slice(0, 60);
|
|
270
|
+
return ok([
|
|
271
|
+
`# Decanter ${version} tokens matching "${query || '(all)'}"`,
|
|
272
|
+
`${hits.length} match${hits.length === 1 ? '' : 'es'}${hits.length > shown.length ? `, showing ${shown.length}` : ''}`,
|
|
273
|
+
``,
|
|
274
|
+
...shown.map((t) => `- \`${t.name}\`: \`${t.value}\` — ${t.file}`),
|
|
275
|
+
``,
|
|
276
|
+
`Use the token, never the literal value. \`var(${shown[0].name})\` or the Tailwind`,
|
|
277
|
+
`utility Decanter generates from it.`,
|
|
278
|
+
``,
|
|
279
|
+
`A token name does not tell you whether a colour pairing passes contrast.`,
|
|
280
|
+
`Decanter's palette contains both passing and failing combinations, so check`,
|
|
281
|
+
`pairings at design time.`,
|
|
282
|
+
].join('\n'));
|
|
283
|
+
}
|