ampless 1.0.0-beta.56 → 1.0.0-beta.58
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/dist/index.d.ts +22 -0
- package/docs/plugin-author-guide.ja.md +4 -0
- package/docs/plugin-author-guide.md +15 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -337,6 +337,20 @@ type ScriptStrategy = 'afterInteractive' | 'lazyOnload';
|
|
|
337
337
|
* per-post context lands in Phase 4 (`plugin-per-post-rfp.md`).
|
|
338
338
|
*/
|
|
339
339
|
interface PluginPublicRenderContext {
|
|
340
|
+
/**
|
|
341
|
+
* The site's `name` / `url` / `description` block. When the caller
|
|
342
|
+
* wires `@ampless/runtime`'s `createPluginHead(cmsConfig, pluginSettings,
|
|
343
|
+
* siteSettings)` with its third argument (as `createAmpless` does), this
|
|
344
|
+
* is the **effective** site settings — the S3-cached admin
|
|
345
|
+
* `settings.public` override merged over the `cms.config.ts` defaults,
|
|
346
|
+
* the same value the `/<slug>.md` route's canonical line uses — not
|
|
347
|
+
* merely a static passthrough of `cms.config.ts`. It falls back to the
|
|
348
|
+
* `cms.config.ts` block on a site-settings fetch failure, or entirely
|
|
349
|
+
* when the caller omits `siteSettings` (the two-argument
|
|
350
|
+
* `createPluginHead` call, kept for backward compatibility). The type
|
|
351
|
+
* shape (`{ name, url, description? }`) does not change either way —
|
|
352
|
+
* only which value populates it.
|
|
353
|
+
*/
|
|
340
354
|
site: Config['site'];
|
|
341
355
|
/**
|
|
342
356
|
* Resolve a public setting value for the active plugin instance.
|
|
@@ -1638,6 +1652,14 @@ interface HistoryConfig {
|
|
|
1638
1652
|
interface AiConfig {
|
|
1639
1653
|
/** Serve the per-post markdown projection at `/<slug>.md`. Default: true. */
|
|
1640
1654
|
markdownRoutes?: boolean;
|
|
1655
|
+
/** Serve a site-wide AI index at `/llms.txt`. `false` disables the
|
|
1656
|
+
* route; an object caps how many recent posts are listed (the
|
|
1657
|
+
* underlying published index returns full bodies, so large limits
|
|
1658
|
+
* are comparatively expensive for now).
|
|
1659
|
+
* Default: enabled with `{ limit: 100 }` (clamped to 1..1000). */
|
|
1660
|
+
llmsTxt?: boolean | {
|
|
1661
|
+
limit?: number;
|
|
1662
|
+
};
|
|
1641
1663
|
}
|
|
1642
1664
|
type Role = 'reader' | 'editor' | 'admin';
|
|
1643
1665
|
interface AuthContext {
|
|
@@ -351,6 +351,8 @@ SSR がデッドラインなしでブロックします。ネットワーク呼
|
|
|
351
351
|
|
|
352
352
|
`ctx.setting()` は Phase 2 で追加された admin 管理値アクセッサ — §8 参照。
|
|
353
353
|
|
|
354
|
+
**`ctx.site` は `cms.config.ts` の静的な値そのままではなく、実効 site 設定です。** ホストアプリが `@ampless/runtime` の `createPluginHead(cmsConfig, pluginSettings, siteSettings)` を第 3 引数つきで配線している場合(`createAmpless` は標準でこう配線しており、サイト側のコード変更は不要)、`ctx.site` は admin の `settings.public` override を `cms.config.ts` のデフォルトにマージした値 — `/<slug>.md` ルートの canonical 行が使うのと同じ実効値 — を反映します。site settings の取得に失敗した場合は `cms.config.ts` の値にフォールバックします。型の形(`{ name, url, description? }`)は変わらず、値の意味だけが変わります。`ctx.site.url` から絶対 URL を組み立てるプラグイン(例: `@ampless/plugin-ai-actions` の外部 AI リンク)は、再デプロイなしで admin が編集した site URL の変更を自動的に反映します。
|
|
355
|
+
|
|
354
356
|
---
|
|
355
357
|
|
|
356
358
|
## 6. Descriptor リファレンス
|
|
@@ -1693,6 +1695,8 @@ it('admin が空文字保存した場合は空配列', () => {
|
|
|
1693
1695
|
- [`packages/plugin-webhook`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-webhook) — trusted hook + 外向き HTTP + `secretSettings` (admin 管理の signing secret、Phase 6a)
|
|
1694
1696
|
- [`packages/plugin-og-image`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-og-image) — `ogImage` ルートレンダラ
|
|
1695
1697
|
- [`packages/plugin-schema-jsonld`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-schema-jsonld) — `publicBodyForPost` + `schema` capability、投稿単位 Article JSON-LD。(Phase 4)
|
|
1698
|
+
- [`packages/plugin-reading-time`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-reading-time) — `publicHtmlForPost`、語数推定を本文の前後に `<p>` バッジとして描画。(Phase 6d)
|
|
1699
|
+
- [`packages/plugin-ai-actions`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-ai-actions) — `publicHtmlForPost`、`ctx.site.url`(実効 site 設定)と投稿の `/<slug>.md` URL から「Markdown で表示」+ opt-in の「Claude で開く」/「ChatGPT で開く」リンクを組み立てる。(AI-readable publishing ロードマップ Phase B)
|
|
1696
1700
|
|
|
1697
1701
|
---
|
|
1698
1702
|
|
|
@@ -434,6 +434,19 @@ The `ctx` object carries:
|
|
|
434
434
|
`ctx.setting()` is the Phase 2 admin-managed values accessor — see
|
|
435
435
|
§8.
|
|
436
436
|
|
|
437
|
+
**`ctx.site` is the effective site settings, not a static passthrough of
|
|
438
|
+
`cms.config.ts`.** When the host app wires `@ampless/runtime`'s
|
|
439
|
+
`createPluginHead(cmsConfig, pluginSettings, siteSettings)` with its third
|
|
440
|
+
argument (as `createAmpless` does — this is the standard wiring, no site
|
|
441
|
+
code changes needed), `ctx.site` reflects admin `settings.public`
|
|
442
|
+
overrides merged over the `cms.config.ts` defaults — the same effective
|
|
443
|
+
value the `/<slug>.md` route's canonical line uses. It falls back to the
|
|
444
|
+
`cms.config.ts` block on a site-settings fetch failure. The shape
|
|
445
|
+
(`{ name, url, description? }`) is unchanged; only which value populates
|
|
446
|
+
it. Plugins that build absolute URLs from `ctx.site.url` (e.g.
|
|
447
|
+
`@ampless/plugin-ai-actions`'s external AI links) automatically track
|
|
448
|
+
admin-edited site URL changes without a redeploy.
|
|
449
|
+
|
|
437
450
|
---
|
|
438
451
|
|
|
439
452
|
## 6. Descriptor reference
|
|
@@ -2308,6 +2321,8 @@ Worked examples to crib from:
|
|
|
2308
2321
|
- [`packages/plugin-webhook`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-webhook) — trusted hook with outbound HTTP + `secretSettings` (admin-managed signing secret, Phase 6a).
|
|
2309
2322
|
- [`packages/plugin-og-image`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-og-image) — `ogImage` route renderer.
|
|
2310
2323
|
- [`packages/plugin-schema-jsonld`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-schema-jsonld) — `publicBodyForPost` + `schema` capability; per-post Article JSON-LD. (Phase 4)
|
|
2324
|
+
- [`packages/plugin-reading-time`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-reading-time) — `publicHtmlForPost`; word-count estimate rendered as a `<p>` badge before/after the post body. (Phase 6d)
|
|
2325
|
+
- [`packages/plugin-ai-actions`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-ai-actions) — `publicHtmlForPost`; "View as Markdown" + opt-in "Open in Claude" / "Open in ChatGPT" links built from `ctx.site.url` (effective site settings) and the post's `/<slug>.md` URL. (AI-readable publishing roadmap, Phase B)
|
|
2311
2326
|
|
|
2312
2327
|
---
|
|
2313
2328
|
|