@sightmap/mcp 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/README.md +79 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +1361 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +171 -0
- package/dist/index.js +1206 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @sightmap/mcp
|
|
2
|
+
|
|
3
|
+
MCP server that wraps `@playwright/mcp` and adds sightmap-aware tools for
|
|
4
|
+
browser-driving agents.
|
|
5
|
+
|
|
6
|
+
## Tools
|
|
7
|
+
|
|
8
|
+
### Browser tools (require an upstream)
|
|
9
|
+
|
|
10
|
+
| Tool | Purpose |
|
|
11
|
+
|---|---|
|
|
12
|
+
| `sightmap_match` | Pure-query: matches a URL against the loaded sightmap and returns view, components, requests, and aggregated memory. |
|
|
13
|
+
| `sightmap_snapshot` | ARIA snapshot enriched with sightmap awareness (matched view, applicable components with live `matchCount`). |
|
|
14
|
+
| `sightmap_act` | Click / type / hover by sightmap component name; raw `selector` is an escape hatch. |
|
|
15
|
+
| `sightmap_network_requests` | Recent network requests, annotated with sightmap names where the request URL+method matches a sightmap `requests:` entry. |
|
|
16
|
+
|
|
17
|
+
### Curation tools
|
|
18
|
+
|
|
19
|
+
The MCP also exposes a five-tool family for `.sightmap/` authoring:
|
|
20
|
+
|
|
21
|
+
| Tool | Purpose |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `sightmap_list_views` | List all views (compact summary by default; pass `detail: "full"` for the entire view). |
|
|
24
|
+
| `sightmap_get_view` | Fetch a single view + its source file path. |
|
|
25
|
+
| `sightmap_check` | Validate the sightmap (`level: "schema"` or `"quality"`; default `"quality"`). |
|
|
26
|
+
| `sightmap_update_view` | Patch a view's agent-authored fields (`description`, `intent`, `memory_append`, `memory_replace`). |
|
|
27
|
+
| `sightmap_init_project` | Scaffold an empty `.sightmap/` in a target project. |
|
|
28
|
+
|
|
29
|
+
Curation write tools operate on the directory passed via `--curate-root`
|
|
30
|
+
(defaults to the first `--sightmap-dir`).
|
|
31
|
+
|
|
32
|
+
**Component / route / selector edits are not exposed via MCP** — those are
|
|
33
|
+
codegen-owned. To track a new component, add a `data-sightmap` attribute to
|
|
34
|
+
source and re-run `sightmap-react gen`.
|
|
35
|
+
|
|
36
|
+
## Prompts
|
|
37
|
+
|
|
38
|
+
The MCP server also exposes prompt templates for multi-step authoring workflows.
|
|
39
|
+
|
|
40
|
+
### `sightmap_sep_track`
|
|
41
|
+
|
|
42
|
+
Walks an author through writing a Sightmap Enhancement Proposal (SEP), the matching `spec/` change, and the matching `conformance/` fixture in four phases:
|
|
43
|
+
|
|
44
|
+
| Phase | Produces | Confirmation gate? |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `draft` | `seps/NNNN-{slug}.md` from the template | Yes |
|
|
47
|
+
| `spec` | A diff against `spec/` referencing the SEP | Yes |
|
|
48
|
+
| `fixture` | `conformance/<NNN>-{slug}/` with `sightmap/` input + `expected.json` | Yes |
|
|
49
|
+
| `verify` | A summary message with hand-off instructions | No (terminal) |
|
|
50
|
+
|
|
51
|
+
**Arguments:**
|
|
52
|
+
- `phase` (required): one of `draft`, `spec`, `fixture`, `verify`.
|
|
53
|
+
- `slug` (optional): kebab-case short slug, e.g. `extend-memory`.
|
|
54
|
+
- `sep_number` (optional, set after `draft`): the four-digit SEP number you claimed.
|
|
55
|
+
|
|
56
|
+
**Confirmation gates** are encoded as text directives at the end of each non-final phase's message ("Stop here. Show the draft to the user, ask for explicit 'go' before calling this prompt again with `phase: \"spec\"`."). The agent honors them; MCP itself has no native pause-and-await primitive for prompts.
|
|
57
|
+
|
|
58
|
+
**Why this exists:** SEPs require coordinated edits across three trees (`seps/`, `spec/`, `conformance/`). The track encodes the order, the dependencies, and the user check-in points so neither the author nor the agent can short-circuit them. Pattern adapted from Archcore's `architecture_track`.
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
sightmap-mcp \
|
|
64
|
+
--sightmap-dir ./.sightmap \
|
|
65
|
+
--curate-root ./.sightmap \
|
|
66
|
+
-- npx -y @playwright/mcp@latest
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Flags
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
--sightmap-dir <path> Directory of sightmap YAML files. Repeatable.
|
|
73
|
+
Default: .sightmap
|
|
74
|
+
--curate-root <path> Writable .sightmap/ for curation tools.
|
|
75
|
+
Default: the first --sightmap-dir.
|
|
76
|
+
--upstream-command <cmd> Command to spawn the upstream MCP server. Default: npx
|
|
77
|
+
-- <args...> Args for the upstream command.
|
|
78
|
+
Default: -y @playwright/mcp@latest
|
|
79
|
+
```
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface CliArgs {
|
|
3
|
+
sightmapDirs: string[];
|
|
4
|
+
curateRoot: string;
|
|
5
|
+
upstreamCommand: string;
|
|
6
|
+
upstreamArgs: string[];
|
|
7
|
+
}
|
|
8
|
+
/** Argv parser. Exposed for unit testing. */
|
|
9
|
+
declare function parseArgv(argv: string[]): CliArgs;
|
|
10
|
+
|
|
11
|
+
export { parseArgv };
|