create-ampless 1.0.0-beta.177 → 1.0.0-beta.181

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.js CHANGED
@@ -1912,6 +1912,7 @@ var AMPLESS_PACKAGES = /* @__PURE__ */ new Set([
1912
1912
  "ampless",
1913
1913
  "@ampless/admin",
1914
1914
  "@ampless/backend",
1915
+ "@ampless/plugin-ai-actions",
1915
1916
  "@ampless/plugin-analytics-ga4",
1916
1917
  "@ampless/plugin-cookie-consent",
1917
1918
  "@ampless/plugin-gtm",
@@ -128,3 +128,35 @@ body {
128
128
  margin-top: 0;
129
129
  margin-bottom: 0;
130
130
  }
131
+
132
+ /* Default styling for first-party plugin hooks. publicHtmlForPost output
133
+ renders OUTSIDE .prose (sibling of the post body), so it inherits no
134
+ typography. Zero-specificity :where() so any theme tokens.css or site
135
+ CSS override always wins. */
136
+ :where(.ampless-reading-time) {
137
+ margin: 1.25rem 0; /* symmetric margin — works for either beforeContent or afterContent placement */
138
+ font-size: 0.8125rem;
139
+ color: var(--muted-foreground);
140
+ }
141
+ :where(.ampless-ai-actions) {
142
+ display: flex;
143
+ flex-wrap: wrap;
144
+ gap: 0.5rem;
145
+ margin: 1.5rem 0; /* symmetric margin — works for either beforeContent or afterContent placement */
146
+ font-size: 0.8125rem;
147
+ }
148
+ :where(.ampless-ai-actions a) {
149
+ color: var(--muted-foreground);
150
+ text-decoration: none;
151
+ border: 1px solid var(--border);
152
+ border-radius: 9999px; /* pill shape. Themes that want --radius instead can override in one line. */
153
+ padding: 0.25em 0.85em;
154
+ white-space: nowrap;
155
+ }
156
+ :where(.ampless-ai-actions a:hover) {
157
+ color: var(--foreground);
158
+ border-color: var(--foreground);
159
+ }
160
+ :where(.ampless-ai-actions .ampless-ai-actions-sep) {
161
+ display: none; /* separators are redundant once links are rendered as pills */
162
+ }
@@ -3,6 +3,7 @@ import seoPlugin from '@ampless/plugin-seo'
3
3
  import rssPlugin from '@ampless/plugin-rss'
4
4
  // import schemaJsonLdPlugin from '@ampless/plugin-schema-jsonld'
5
5
  // import readingTimePlugin from '@ampless/plugin-reading-time'
6
+ // import aiActionsPlugin from '@ampless/plugin-ai-actions'
6
7
  // import cookieConsentPlugin from '@ampless/plugin-cookie-consent'
7
8
  // import analyticsGa4Plugin from '@ampless/plugin-analytics-ga4'
8
9
  // import gtmPlugin from '@ampless/plugin-gtm'
@@ -104,6 +105,21 @@ export default defineConfig({
104
105
  //
105
106
  // readingTimePlugin(),
106
107
  //
108
+ // AI actions: adds a "View as Markdown" link (default on) after the
109
+ // post content, plus opt-in "Open in Claude" / "Open in ChatGPT"
110
+ // links. REQUIRES `ai.markdownRoutes` to stay enabled (the default
111
+ // above) — every link this plugin renders points at the post's
112
+ // /<slug>.md route. Do not register this plugin if you set
113
+ // `ai: { markdownRoutes: false }`. See packages/ampless/docs/plugin-author-guide.md
114
+ // and the package README for why the external links default OFF
115
+ // (unofficial URL prefill convention) and why there's no "Copy
116
+ // Markdown" button (no inline-script capability yet).
117
+ //
118
+ // aiActionsPlugin({
119
+ // showClaude: false, // opt-in — verify the ?q= prefill on your site first
120
+ // showChatgpt: false, // opt-in — same caveat
121
+ // }),
122
+ //
107
123
  // Google Analytics 4. Once registered here, the measurement ID can be
108
124
  // edited from `/admin/plugins` without a redeploy — the constructor
109
125
  // value below is just the initial default. Pass an empty string to
@@ -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 リファレンス
@@ -1682,6 +1684,8 @@ it('admin が空文字保存した場合は空配列', () => {
1682
1684
  - [`packages/plugin-webhook`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-webhook) — trusted hook + 外向き HTTP + `secretSettings` (admin 管理の signing secret、Phase 6a)
1683
1685
  - [`packages/plugin-og-image`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-og-image) — `ogImage` ルートレンダラ
1684
1686
  - [`packages/plugin-schema-jsonld`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-schema-jsonld) — `publicBodyForPost` + `schema` capability、投稿単位 Article JSON-LD。(Phase 4)
1687
+ - [`packages/plugin-reading-time`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-reading-time) — `publicHtmlForPost`、語数推定を本文の前後に `<p>` バッジとして描画。(Phase 6d)
1688
+ - [`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)
1685
1689
 
1686
1690
  ---
1687
1691
 
@@ -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
@@ -2296,6 +2309,8 @@ Worked examples to crib from:
2296
2309
  - [`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).
2297
2310
  - [`packages/plugin-og-image`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-og-image) — `ogImage` route renderer.
2298
2311
  - [`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)
2312
+ - [`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)
2313
+ - [`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)
2299
2314
 
2300
2315
  ---
2301
2316
 
@@ -26,21 +26,22 @@
26
26
  "@tiptap/pm": "^3.23.6",
27
27
  "@tiptap/react": "^3.23.6",
28
28
  "@tiptap/starter-kit": "^3.23.6",
29
- "@ampless/plugin-analytics-ga4": "^0.2.0-beta.41",
30
- "@ampless/plugin-cookie-consent": "^0.1.0-beta.32",
31
- "@ampless/plugin-gtm": "^0.2.0-beta.40",
32
- "@ampless/plugin-og-image": "^0.2.0-beta.57",
33
- "@ampless/plugin-plausible": "^0.2.0-beta.40",
34
- "@ampless/plugin-reading-time": "^0.1.0-beta.30",
35
- "@ampless/plugin-rss": "^0.2.0-beta.57",
36
- "@ampless/plugin-schema-jsonld": "^0.1.1-beta.36",
37
- "@ampless/plugin-seo": "^0.2.0-beta.57",
38
- "@ampless/plugin-webhook": "^0.2.0-beta.58",
39
- "@ampless/admin": "^1.0.0-beta.105",
40
- "@ampless/backend": "^1.0.0-beta.87",
41
- "@ampless/runtime": "^1.0.0-beta.70",
29
+ "@ampless/plugin-ai-actions": "^0.1.0-beta.1",
30
+ "@ampless/plugin-analytics-ga4": "^0.2.0-beta.42",
31
+ "@ampless/plugin-cookie-consent": "^0.1.0-beta.33",
32
+ "@ampless/plugin-gtm": "^0.2.0-beta.41",
33
+ "@ampless/plugin-og-image": "^0.2.0-beta.58",
34
+ "@ampless/plugin-plausible": "^0.2.0-beta.41",
35
+ "@ampless/plugin-reading-time": "^0.1.0-beta.32",
36
+ "@ampless/plugin-rss": "^0.2.0-beta.58",
37
+ "@ampless/plugin-schema-jsonld": "^0.1.1-beta.37",
38
+ "@ampless/plugin-seo": "^0.2.0-beta.58",
39
+ "@ampless/plugin-webhook": "^0.2.0-beta.59",
40
+ "@ampless/admin": "^1.0.0-beta.106",
41
+ "@ampless/backend": "^1.0.0-beta.88",
42
+ "@ampless/runtime": "^1.0.0-beta.71",
42
43
  "@digital-go-jp/tailwind-theme-plugin": "^0.3.4",
43
- "ampless": "^1.0.0-beta.57",
44
+ "ampless": "^1.0.0-beta.58",
44
45
  "aws-amplify": "^6.17.0",
45
46
  "class-variance-authority": "^0.7.1",
46
47
  "clsx": "^2.1.1",
@@ -122,6 +122,7 @@ export default defineConfig({
122
122
 
123
123
  **`publicHtmlForPost` を使うファーストパーティプラグイン:**
124
124
  - `@ampless/plugin-reading-time` — 投稿本文から読了時間を推定し、本文の前後に設定可能なバッジを注入します。
125
+ - `@ampless/plugin-ai-actions` — 「Markdown で表示」リンク(デフォルトオン)と、opt-in の「Claude で開く」「ChatGPT で開く」リンクを本文の後(または前)に追加します。`ai.markdownRoutes` の有効化が前提です。
125
126
 
126
127
  [guide]: https://github.com/heavymoons/ampless/blob/main/packages/ampless/docs/plugin-author-guide.md
127
128
 
@@ -125,6 +125,7 @@ Capabilities currently active:
125
125
 
126
126
  **First-party plugins that use `publicHtmlForPost`:**
127
127
  - `@ampless/plugin-reading-time` — estimates read time from the post body and injects a configurable badge before or after the content.
128
+ - `@ampless/plugin-ai-actions` — adds a "View as Markdown" link (default on) plus opt-in "Open in Claude" / "Open in ChatGPT" links after (or before) the content. Requires `ai.markdownRoutes` to stay enabled.
128
129
 
129
130
  [guide]: https://github.com/heavymoons/ampless/blob/main/packages/ampless/docs/plugin-author-guide.md
130
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ampless",
3
- "version": "1.0.0-beta.177",
3
+ "version": "1.0.0-beta.181",
4
4
  "description": "Create a new ampless project",
5
5
  "license": "MIT",
6
6
  "type": "module",