emdash-plugin-sitegraph 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +92 -2
- package/dist/index.d.mts +9 -0
- package/dist/index.mjs +957 -0
- package/package.json +49 -5
- package/src/admin/api.ts +115 -0
- package/src/admin/details.tsx +420 -0
- package/src/admin/explorer.tsx +562 -0
- package/src/admin/graph-canvas.tsx +222 -0
- package/src/admin/index.tsx +47 -0
- package/src/admin/layout.ts +114 -0
- package/src/admin/node-picker.tsx +69 -0
- package/src/admin/sitegraph.css +798 -0
- package/src/domain/graph.ts +95 -0
- package/src/domain/impact.ts +102 -0
- package/src/domain/links.ts +107 -0
- package/src/index.ts +68 -0
- package/src/routes.ts +294 -0
- package/src/scan.ts +379 -0
- package/src/store.ts +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Krushna Raval
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,93 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SiteGraph for EmDash
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A map of how your EmDash site fits together. SiteGraph reads your published entries and the
|
|
4
|
+
internal links between them, lets you add what the CMS can't see (the form that feeds your CRM,
|
|
5
|
+
the workflow a page belongs to, who owns it), and answers one question before you change
|
|
6
|
+
something: **what else depends on this?**
|
|
7
|
+
|
|
8
|
+
- **Graph explorer.** Search any entry, URL, form or service and expand outward from it.
|
|
9
|
+
A table view shows the same connections for keyboard and screen-reader users.
|
|
10
|
+
- **Broken internal links.** A link to an entry path where no published entry lives is
|
|
11
|
+
flagged, including links left behind when a page's slug changes.
|
|
12
|
+
- **Change impact.** Up to 3 steps out, with the exact path for each result, split into
|
|
13
|
+
confirmed connections and ones that rely on a guess.
|
|
14
|
+
- **Your own notes.** Purpose, criticality, maintenance notes, a runbook link and a
|
|
15
|
+
"last checked" date on anything in the graph. Rescans never overwrite them.
|
|
16
|
+
- **Stays current.** After the first scan, saving, publishing, unpublishing or deleting an
|
|
17
|
+
entry updates just that entry's part of the map.
|
|
18
|
+
- **JSON export** of the whole graph.
|
|
19
|
+
|
|
20
|
+
Every connection says where it came from: **found by scan** (solid line), **added by a person**
|
|
21
|
+
(dashed). SiteGraph never presents a guess as a fact, and impact is "potential impact", not proof.
|
|
22
|
+
|
|
23
|
+
Requires EmDash 1.2.0 or later.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
SiteGraph is a **native** plugin, so it's installed from npm and registered in your Astro
|
|
28
|
+
config. It isn't in the EmDash plugin registry.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm add emdash-plugin-sitegraph
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
// astro.config.mjs
|
|
36
|
+
import { siteGraph } from "emdash-plugin-sitegraph";
|
|
37
|
+
|
|
38
|
+
export default defineConfig({
|
|
39
|
+
integrations: [
|
|
40
|
+
emdash({
|
|
41
|
+
plugins: [siteGraph()],
|
|
42
|
+
}),
|
|
43
|
+
],
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Rebuild and deploy, then open **SiteGraph** in the admin sidebar and choose **Scan site**.
|
|
48
|
+
|
|
49
|
+
Set your site URL in EmDash's settings. Without it, only relative links (like `/about`) are
|
|
50
|
+
recognised as internal.
|
|
51
|
+
|
|
52
|
+
## Why native, and what it can do
|
|
53
|
+
|
|
54
|
+
The interactive graph is a custom React admin page, and only native plugins can ship one.
|
|
55
|
+
Native plugins run inside your site's process, without the sandbox's isolation, so install
|
|
56
|
+
them only from publishers you trust. SiteGraph keeps its footprint small on purpose:
|
|
57
|
+
|
|
58
|
+
| Capability | Used for |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `content:read` | Reading published entries to find their links |
|
|
61
|
+
| `schema:read` | Reading collection URL patterns, title fields and `url` fields |
|
|
62
|
+
|
|
63
|
+
It never writes to your content, makes no network requests (links are parsed, never
|
|
64
|
+
fetched), and stores its graph in its own plugin storage. Viewing the graph needs the
|
|
65
|
+
`plugins:read` permission (Editors and up). Scanning and editing it needs `plugins:manage`
|
|
66
|
+
(Admins).
|
|
67
|
+
|
|
68
|
+
## Limits worth knowing
|
|
69
|
+
|
|
70
|
+
- Links are found in rich text and `url` fields. **Reference fields aren't mapped yet**,
|
|
71
|
+
because EmDash doesn't expose them to plugins.
|
|
72
|
+
- Collections whose URL pattern uses date or locale tokens, and entries in a non-default
|
|
73
|
+
language, are mapped as entries but without a URL.
|
|
74
|
+
- A link is "broken" only when it points where an entry could live (it fits a collection's
|
|
75
|
+
URL pattern) and none does. Links to your home page, listing pages or files are shown,
|
|
76
|
+
never flagged.
|
|
77
|
+
- Search matches from the start of a name or path ("pric" finds "Pricing", "ing" doesn't).
|
|
78
|
+
- The graph shows a neighbourhood at a time, not the whole site, so large sites stay usable.
|
|
79
|
+
|
|
80
|
+
## Develop
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pnpm install
|
|
84
|
+
pnpm test # Vitest: graph logic and scan behaviour
|
|
85
|
+
pnpm typecheck
|
|
86
|
+
pnpm build # server entry → dist/; the admin ships as source
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
See `SPEC.md` for the design decisions and why they were made.
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PluginDescriptor, ResolvedPlugin } from "emdash";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
/** Build-time descriptor: register with `emdash({ plugins: [siteGraph()] })`. */
|
|
5
|
+
declare function siteGraph(): PluginDescriptor;
|
|
6
|
+
/** Runtime entry. EmDash imports this by name. */
|
|
7
|
+
declare function createPlugin(): ResolvedPlugin;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createPlugin, siteGraph as default, siteGraph };
|