pagegraph 0.6.1 → 0.8.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 CHANGED
@@ -34,13 +34,14 @@ bun add -D lighthouse # only for `pagegraph audit` performance evidence
34
34
  | `pagegraph/audit` | Audit services, scanner protocol, rules, and report schemas | `effect` |
35
35
  | `pagegraph` bin | CLI over the same graph | bundled — runs on Bun |
36
36
 
37
- The core and React entries have **zero runtime dependencies** — everything above is a
38
- peer, and only the entries you import need theirs installed.
37
+ The core and React import graphs have **zero runtime dependencies** — everything they use is a
38
+ peer, and only the entries you import need those peers loaded.
39
39
 
40
- The CLI **bundles Effect and the TypeSafe provider**, so it needs no Effect peers and does not
41
- depend on the app's Effect RC; it runs on [Bun](https://bun.sh) (`bunx pagegraph`). `vite` stays a
42
- peer — the graph commands load your app through Vite at runtime — and `lighthouse` is only needed by
43
- `pagegraph audit`. Importing `pagegraph/audit` programmatically still needs `effect`.
40
+ The CLI **bundles PageGraph's Effect and TypeSafe provider runtime**, so it does not depend on the
41
+ app's Effect RC; it runs on [Bun](https://bun.sh) (`bunx pagegraph`). Agentic workflows load the
42
+ OpenCode SDK and its private Effect runtime only when invoked. `vite` stays a peer — graph commands
43
+ load your app through Vite at runtime — and `lighthouse` is only needed by `pagegraph audit`.
44
+ Importing `pagegraph/audit` programmatically still needs `effect`.
44
45
 
45
46
  ## Quick start
46
47
 
@@ -205,6 +206,89 @@ Preview hosts (`indexable: false`) drop `contentSignal` and `directives`;
205
206
  pagegraph check
206
207
  ```
207
208
 
209
+ ## Agentic workflows
210
+
211
+ PageGraph can combine the deterministic route graph with a project-owned embedded OpenCode agent,
212
+ live tools exposed by an Executor plugin, and Jev decisions. Scaffold the OpenCode preset once:
213
+
214
+ ```bash
215
+ pagegraph init
216
+ ```
217
+
218
+ The generated `.pagegraph/opencode` directory contains one `seo` agent and customizable `content`,
219
+ `technical`, and `authority` skills. Add your Executor plugin to its `opencode.jsonc`; OpenCode and
220
+ the plugin own model and Executor authentication. PageGraph does not copy credentials or assume
221
+ fixed provider-tool addresses.
222
+
223
+ Enable workflows in `seo.config.ts`:
224
+
225
+ ```ts
226
+ export default defineSeoConfig({
227
+ // origin, disallow, and loadGraph as above
228
+ workflows: {
229
+ opencode: {
230
+ configDirectory: ".pagegraph/opencode",
231
+ defaultModel: "openrouter/example/model",
232
+ models: {
233
+ "research.keywords": "openrouter/example/research-model",
234
+ },
235
+ },
236
+ context: {
237
+ files: ["AGENTS.md"],
238
+ byWorkflow: {
239
+ "research.keywords": ["docs/seo/measurement.md"],
240
+ },
241
+ },
242
+ runsDirectory: ".pagegraph/runs",
243
+ },
244
+ });
245
+ ```
246
+
247
+ Run a page-backed workflow:
248
+
249
+ ```bash
250
+ pagegraph research keywords \
251
+ --query "transactional email api" \
252
+ --market us \
253
+ --language en
254
+ ```
255
+
256
+ Every workflow starts from the selected graph and context files, asks the SEO agent to search
257
+ Executor's live catalog and compose suitable tools, then evaluates its structured observations with
258
+ Jev. Tool paths are discovered at runtime; the generated skills contain editable starter recipes,
259
+ not a fixed integration list.
260
+
261
+ | Command | Result |
262
+ | --- | --- |
263
+ | `research keywords` | Query demand, intent, and page ownership opportunities |
264
+ | `research competitors` | Competitor topics, pages, and positioning evidence |
265
+ | `research authority` | Qualified editorial, directory, partner, and community opportunities |
266
+ | `analyze serp` | Search-result intent and page-shape fit |
267
+ | `analyze content` | Substance, answer quality, and intent overlap |
268
+ | `analyze ai-search` | Citation readiness and answer-engine coverage |
269
+ | `plan architecture` | A page-backed information-architecture plan |
270
+ | `improve content` | Evidence-backed source copy edits |
271
+ | `improve metadata` | Title and description edits at the owning source |
272
+ | `improve schema` | Structured-data edits justified by visible content |
273
+ | `improve links` | Contextual internal-link edits from graph and page evidence |
274
+
275
+ The common selectors are repeatable `--page`, `--query`, and `--kind`, plus `--limit`, `--market`,
276
+ `--language`, `--refresh`, `--model`, `--opencode-config`, and `--out`. Relevant workflows also
277
+ accept `--competitor`, `--domain`, or `--device desktop|mobile`. Workflows are noninteractive and
278
+ fail immediately if the agent asks a question or requests permission.
279
+
280
+ The four `improve` workflows write source files by default and require a clean Git tree. Use
281
+ `--dry-run` to keep repository edit and shell tools disabled, or `--allow-dirty` when you explicitly
282
+ want the agent to edit alongside existing changes. PageGraph leaves every diff uncommitted and
283
+ records modified, added, and deleted files after the workflow finishes.
284
+
285
+ Each run writes `.pagegraph/runs/<run-id>/run.json` and `summary.md`. The JSON retains the
286
+ deterministic graph, context, complete OpenCode session export, Executor tool evidence, Jev question
287
+ definitions and answers, Git provenance, changed files, and model provenance. Keep this directory
288
+ ignored: provider output can be large or account-specific. Workflows fail when the configured model,
289
+ active Executor plugin, catalog search plus discovered tool call, or `TYPESAFE_API_KEY` for Jev is
290
+ unavailable.
291
+
208
292
  ## Typed paths
209
293
 
210
294
  Augment `Register` (the same pattern TanStack Router uses) and `related` /
@@ -308,7 +392,8 @@ pagegraph links verify <url> # crawl served HTML: depth, orphans, declared-vs
308
392
  pagegraph links verify <url> --assert-coverage # also assert seo.config.ts coverage on served anchors
309
393
  pagegraph links verify <url> --emit-rendered <file> # save the rendered edge set
310
394
  pagegraph links candidates # propose contextual links from the declared graph
311
- pagegraph links decide <file> # answer typed link questions with Jev (TYPESAFE_API_KEY)
395
+ pagegraph research keywords --query "email api" # combine graph, Executor, and Jev evidence
396
+ pagegraph improve metadata --page /pricing # apply a clean-tree source improvement
312
397
  pagegraph sitemap # print sitemap.xml
313
398
  pagegraph robots # print robots.txt
314
399
  ```
@@ -394,36 +479,18 @@ Pairs already declared as a `related` edge are excluded, and `--rendered` accept
394
479
  a JSON dump of already-served anchors (`[{ from, to }]` or `{ edges: [...] }`) to
395
480
  exclude those too.
396
481
 
397
- The output is a reviewable plan: human text by default, versioned JSON with
398
- `--json`. Nothing is applied. `--limit` and `--cluster` bound the plan, and
399
- `--decide` optionally hands the candidates to Jev for a recommendation and
400
- confidence per pair (requires `TYPESAFE_API_KEY`):
482
+ The output is a deterministic, reviewable plan: human text by default and
483
+ versioned JSON with `--json`. Nothing is applied; `--limit` and `--cluster`
484
+ bound the plan. Use `pagegraph improve links` when you want Executor evidence,
485
+ Jev evaluation, and source edits:
401
486
 
402
487
  ```bash
403
488
  pagegraph links candidates
404
489
  pagegraph links candidates --cluster blog --limit 20
405
490
  pagegraph links candidates --rendered rendered.json --json | jq
406
- pagegraph links candidates --decide
491
+ pagegraph improve links --page "/docs/**"
407
492
  ```
408
493
 
409
- ### Decide with Jev
410
-
411
- `pagegraph links decide` answers two typed questions per candidate — *does the source have a genuine
412
- reason to link to the destination?* and *is descriptive anchor text already in the copy?* — and
413
- routes anything inside the confidence band `(1−t, t)` to a `review` bucket instead of auto-applying.
414
-
415
- ```bash
416
- pagegraph links decide candidates.json --threshold 0.9
417
- pagegraph links decide candidates.json --threshold 0.9 --json | jq
418
- cat candidates.json | pagegraph links decide
419
- ```
420
-
421
- Decisions run through [Jev](https://typesafe.ai) via `@effect/ai-typesafe` (model `jev-latest`),
422
- bundled into the CLI. The API key is read from the **`TYPESAFE_API_KEY` environment variable** — it
423
- is deliberately not a `seo.config.ts` field, so keys never live in the repo; `seo.config.ts` carries
424
- non-secret decision settings only. Without a key the command exits 1 with a clear message and an
425
- empty stdout.
426
-
427
494
  ### Contextual-link coverage
428
495
 
429
496
  Declare a contextual-link coverage policy in `seo.config.ts` (a `coverage` array