create-ampless 0.2.0-alpha.19 → 0.2.0-alpha.20

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.ja.md CHANGED
@@ -18,7 +18,7 @@ npx create-ampless@alpha
18
18
  3. テーマ — v0.1 では `blog`
19
19
  4. プラグイン — `seo`、`rss`、`webhook`
20
20
 
21
- 出力は AWS Amplify Gen 2 バックエンド定義を含む Next.js 15(App Router)プロジェクトです。`/admin` に管理パネル、`/` にパブリックブログが設置され、選択したプラグインが `cms.config.ts` にあらかじめ設定されます。また運用メモ用の `RUNBOOK.md` も生成されます。
21
+ 出力は AWS Amplify Gen 2 バックエンド定義を含む Next.js 16(App Router)プロジェクトです。`/admin` に管理パネル、`/` にパブリックブログが設置され、選択したプラグインが `cms.config.ts` にあらかじめ設定されます。また運用メモ用の `RUNBOOK.md` も生成されます。
22
22
 
23
23
  ## 生成されたプロジェクトでの次のステップ
24
24
 
package/README.md CHANGED
@@ -18,7 +18,7 @@ The wizard walks you through:
18
18
  3. Theme — `blog` for v0.1
19
19
  4. Plugins — `seo`, `rss`, `webhook`
20
20
 
21
- Output is a Next.js 15 (App Router) project with the AWS Amplify Gen 2 backend definitions, an admin panel at `/admin`, public blog at `/`, the chosen plugins pre-wired in `cms.config.ts`, and a `RUNBOOK.md` for operations notes.
21
+ Output is a Next.js 16 (App Router) project with the AWS Amplify Gen 2 backend definitions, an admin panel at `/admin`, public blog at `/`, the chosen plugins pre-wired in `cms.config.ts`, and a `RUNBOOK.md` for operations notes.
22
22
 
23
23
  ## Next steps inside the generated project
24
24
 
@@ -0,0 +1,108 @@
1
+ > English: [AGENTS.md](./AGENTS.md)
2
+ >
3
+ # AGENTS.md
4
+
5
+ このファイルは AI コーディングエージェント(Claude Code, Cursor, Codex など)が読む前提で書かれています。人間向けの日常利用ガイドは `README.ja.md` と `RUNBOOK.ja.md` を参照してください。
6
+
7
+ ## プロジェクトのレイアウト
8
+
9
+ - `themes/<name>/` — インストール済みのテーマ(tokens、pages、manifest)。アクティブテーマの切り替えは `/admin/sites/<id>/theme` で行う。
10
+ - `themes/my-<name>/` — ユーザーが所有するカスタマイズ済みのテーマコピー(`npm run copy-theme` で作成)。`my-` プレフィックスがついているコピーは `update-ampless` で上書きされない。
11
+ - `themes-registry.ts` — 自動生成ファイル。手動で編集しない。
12
+ - `amplify/` — TypeScript で定義された Amplify Gen 2 バックエンド(Cognito / DynamoDB / S3 / AppSync / Lambda)。
13
+ - `amplify_outputs.json` — `npm run sandbox` / Amplify Hosting が生成するファイル。編集しない。
14
+ - `app/` — Next.js 15 App Router(公開サイト + `/admin` UI)。
15
+ - `components/` — 共有 UI コンポーネント。
16
+ - `lib/` — 共有ユーティリティ(データアクセス、認証など)。
17
+ - `cms.config.ts` — サイト、プラグイン、デフォルト設定。
18
+ - `proxy.ts` — リクエストプロキシの設定。
19
+
20
+ ## 触っていい場所・ダメな場所
21
+
22
+ **自由に編集可能:**
23
+ - `themes/my-*/` — ユーザー自身のテーマコピー。
24
+ - `cms.config.ts` — サイト / プラグインの設定。
25
+ - 投稿コンテンツは管理 UI(推奨)または MCP サーバー経由で操作する。
26
+
27
+ **注意して触る(編集前に理由を説明すること):**
28
+ - `app/`、`components/`、`lib/` — 共有シェルの一部。`update-ampless` 後も編集は残るが、上流が同じファイルを変更した場合のマージはユーザー側の責任になる。テーマ関連の変更であれば、カスタムテーマ経由での拡張を優先する。
29
+ - `themes/<official-name>/`(`my-` プレフィックスなし)— 公式テーマは `update-ampless` で上書きされる。カスタマイズしたい場合は先に `npm run copy-theme <official-name> my-<your-name>` を実行し、コピーを編集する。
30
+ - `package.json` — `ampless` / `@ampless/*` のバージョンは一貫して管理する。バージョンアップには `update-ampless` を使う。
31
+
32
+ **編集禁止:**
33
+ - `themes-registry.ts` — scaffold / copy-theme / update コマンドが再生成する。
34
+ - `amplify/` — バックエンドのスキーマ変更はテーブルの再構築とサンドボックスデータの消失を招く可能性がある。触る前にユーザーの明示的な確認を得ること。
35
+ - `amplify_outputs.json` — `npm run sandbox` のたびに再生成される。
36
+ - `.amplify/` — Amplify CLI の作業ディレクトリ。
37
+ - `pnpm-lock.yaml` / `package-lock.json` — パッケージマネージャーに任せる。
38
+
39
+ ## テーマのカスタマイズ(標準的な手順)
40
+
41
+ 1. 公式テーマをコピーする:
42
+ ```bash
43
+ npm run copy-theme blog my-blog
44
+ ```
45
+ `my-` プレフィックスがついているコピーは `npm run update-ampless` で上書きされない。ターゲット名が `my-` で始まらない場合、コマンドは実行を拒否する。
46
+
47
+ 2. 以下の優先順位で編集する:
48
+ - `themes/my-blog/tokens.css` — 色、タイポグラフィ、スペーシング(`[data-theme='my-blog']` スコープの CSS カスタムプロパティ)。
49
+ - `themes/my-blog/manifest.ts` — 管理 UI(`/admin/sites/<id>/theme`)に公開するフィールドの宣言。
50
+ - `themes/my-blog/pages/` — レイアウト / 構造(Next.js ページモジュール: フィード、サイトマップ、投稿テンプレート)。
51
+
52
+ 3. テーマを有効化する: `/admin/sites/<siteId>/theme` を開き、`my-blog` を選択する。テーマ切り替えはランタイム設定 — 再デプロイは不要。
53
+
54
+ 4. 動作確認:
55
+ ```bash
56
+ npm run dev # http://localhost:3000
57
+ ```
58
+
59
+ ## MCP サーバー(`@ampless/mcp-server`)
60
+
61
+ エージェントが投稿コンテンツを直接クエリ・編集できる。公開ツール: `list_posts`、`get_post`、`create_post`、`update_post`、`delete_post`、`upload_media`、`get_schema`。
62
+
63
+ 登録方法は 2 つ:
64
+
65
+ **ローカル stdio(Claude Code / Cursor 向け、推奨):**
66
+
67
+ プロジェクトルートの `.mcp.json` に追加する:
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "ampless": {
72
+ "command": "npx",
73
+ "args": ["-y", "@ampless/mcp-server", "--outputs", "./amplify_outputs.json"],
74
+ "env": {
75
+ "AMPLESS_MCP_EMAIL": "<your-admin-email>",
76
+ "AMPLESS_MCP_PASSWORD": "<your-admin-password>"
77
+ }
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ **管理者発行トークンによる HTTP**(ホスト型エージェント向け): `/admin/mcp-tokens` で Bearer トークンを発行し、エージェントクライアントを公開 MCP HTTP エンドポイントに向ける。エンドポイント URL は管理 UI で確認できる。
84
+
85
+ 投稿本文は `markdown`、`html`、`tiptap`(JSON ドキュメント)の 3 フォーマットに対応している。
86
+
87
+ ## 動作確認の基準
88
+
89
+ 変更後は最低限以下を実行すること:
90
+
91
+ - `npm run dev` でブラウザから該当ページを開く。UI / テーマの変更は特に目視確認が必要(Playwright MCP が使える場合はスクリーンショットを活用する)。
92
+ - `npm run build` — 本番ビルドが成功することを確認する。
93
+ - `npm run lint`。
94
+
95
+ UI / テーマを変更した場合、型チェックだけを根拠にタスク完了を報告しない — ブラウザで実際に確認すること。
96
+
97
+ ## 既知の制約
98
+
99
+ - **サンドボックスのデータは揮発性。** スキーマに影響する変更は API とテーブルの再構築を引き起こす可能性がある。サンドボックスのコンテンツは使い捨てとして扱うこと。本番データは永続する。
100
+ - **マルチサイトモードでは SSR キャッシュが無効になる。** `cms.config.sites` に 1 ドメインだけ設定すれば Amplify Hosting CDN キャッシュが有効になる。複数ドメインを設定するとキャッシュが強制的に無効化される。パフォーマンス施策はこの制約を考慮して計画すること。
101
+ - **AppSync 公開 API キーは `amplify_outputs.json` に含まれ、サイト訪問者から見える。** 低信頼の認証情報として扱うこと — このキーの権限は公開済み投稿の読み取りのみ。`api-key-renewer` Lambda が毎月自動ローテーションするため、手動ローテーションは不要。
102
+ - **最初に登録したユーザーが管理者になる。** 以降のロール変更は Cognito コンソールで行う(RUNBOOK 参照)。
103
+
104
+ ## 参照先
105
+
106
+ - `README.ja.md` — サイト運営者向けの日常利用ガイド。
107
+ - `RUNBOOK.ja.md` — 定期的な運用手順(キーローテーション、バックアップ復元など)。
108
+ - `themes/<name>/README.ja.md` — テーマごとのカスタマイズ詳細。
@@ -0,0 +1,108 @@
1
+ > 日本語版: [AGENTS.ja.md](./AGENTS.ja.md)
2
+ >
3
+ # AGENTS.md
4
+
5
+ This file is written for AI coding agents (Claude Code, Cursor, Codex, etc.). For human-readable day-to-day guidance, see `README.md` and `RUNBOOK.md`.
6
+
7
+ ## Project layout
8
+
9
+ - `themes/<name>/` — installed themes (tokens, pages, manifest). Switch active theme at `/admin/sites/<id>/theme`.
10
+ - `themes/my-<name>/` — user-owned customised theme copies (created via `npm run copy-theme`). The `my-` prefix is what marks the copy as user-owned; `update-ampless` leaves anything under `themes/my-*/` alone.
11
+ - `themes-registry.ts` — auto-generated, do not hand-edit.
12
+ - `amplify/` — Amplify Gen 2 backend (Cognito / DynamoDB / S3 / AppSync / Lambda) defined in TypeScript.
13
+ - `amplify_outputs.json` — generated by `npm run sandbox` / Amplify Hosting. Do not edit.
14
+ - `app/` — Next.js 15 App Router (public site + `/admin` UI).
15
+ - `components/` — shared UI components.
16
+ - `lib/` — shared utilities (data access, auth, etc.).
17
+ - `cms.config.ts` — sites, plugins, defaults.
18
+ - `proxy.ts` — request proxy config.
19
+
20
+ ## What you can and can't touch
21
+
22
+ **Free to edit:**
23
+ - `themes/my-*/` — your own theme copies.
24
+ - `cms.config.ts` — site/plugin config.
25
+ - Post content via the admin UI (recommended) or via the MCP server.
26
+
27
+ **Touch with caution (explain why before editing):**
28
+ - `app/`, `components/`, `lib/` — these are part of the shared shell. Edits survive `update-ampless` but you own the merge if upstream changes the same file. Prefer extending via a custom theme if the change is theme-related.
29
+ - `themes/<official-name>/` (no `my-` prefix) — official themes get overwritten by `update-ampless`. If you want to customise, run `npm run copy-theme <official-name> my-<your-name>` first and edit the copy.
30
+ - `package.json` — keep `ampless` / `@ampless/*` versions consistent. Use `update-ampless` to bump them.
31
+
32
+ **Do not edit:**
33
+ - `themes-registry.ts` — regenerated by the scaffold/copy-theme/update commands.
34
+ - `amplify/` — backend schema changes can rebuild tables and wipe sandbox data. Get explicit confirmation from the user before touching.
35
+ - `amplify_outputs.json` — regenerated each `npm run sandbox`.
36
+ - `.amplify/` — Amplify CLI working directory.
37
+ - `pnpm-lock.yaml` / `package-lock.json` — let the package manager update these.
38
+
39
+ ## Customising a theme (the standard flow)
40
+
41
+ 1. Copy an official theme:
42
+ ```bash
43
+ npm run copy-theme blog my-blog
44
+ ```
45
+ The `my-` prefix marks the copy as user-owned so `npm run update-ampless` leaves it alone. The target name must start with `my-` or the command refuses to run.
46
+
47
+ 2. Edit in this priority order:
48
+ - `themes/my-blog/tokens.css` — colours, typography, spacing (CSS custom properties scoped under `[data-theme='my-blog']`).
49
+ - `themes/my-blog/manifest.ts` — declare which fields are exposed in the admin UI (`/admin/sites/<id>/theme`).
50
+ - `themes/my-blog/pages/` — layout / structure (Next.js page modules: feed, sitemap, post templates).
51
+
52
+ 3. Activate the theme: open `/admin/sites/<siteId>/theme` and select `my-blog`. Theme switching is a runtime setting — no redeploy needed.
53
+
54
+ 4. Verify:
55
+ ```bash
56
+ npm run dev # http://localhost:3000
57
+ ```
58
+
59
+ ## MCP server (`@ampless/mcp-server`)
60
+
61
+ Lets agents query and modify post content directly. Tools exposed: `list_posts`, `get_post`, `create_post`, `update_post`, `delete_post`, `upload_media`, `get_schema`.
62
+
63
+ Two registration options:
64
+
65
+ **Local stdio (recommended for Claude Code / Cursor):**
66
+
67
+ Add to `.mcp.json` at the project root:
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "ampless": {
72
+ "command": "npx",
73
+ "args": ["-y", "@ampless/mcp-server", "--outputs", "./amplify_outputs.json"],
74
+ "env": {
75
+ "AMPLESS_MCP_EMAIL": "<your-admin-email>",
76
+ "AMPLESS_MCP_PASSWORD": "<your-admin-password>"
77
+ }
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ **HTTP via admin-issued token** (for hosted agents): issue a Bearer token at `/admin/mcp-tokens` and point the agent client at the public MCP HTTP endpoint. See the admin UI for the exact endpoint URL.
84
+
85
+ Post bodies accept three formats: `markdown`, `html`, or `tiptap` (JSON document).
86
+
87
+ ## Verification expectations
88
+
89
+ After any change, run at minimum:
90
+
91
+ - `npm run dev` and load the affected page in a browser. UI changes especially require visual confirmation (use Playwright MCP for screenshots when available).
92
+ - `npm run build` — confirms the production build succeeds.
93
+ - `npm run lint`.
94
+
95
+ Do not report a task complete based solely on type checks if a UI/theme was modified — load it in a browser.
96
+
97
+ ## Known constraints
98
+
99
+ - **Sandbox data is ephemeral.** Schema-affecting changes can rebuild the API and tables; treat sandbox content as throw-away. Production data is durable.
100
+ - **Multi-site mode disables SSR caching.** A single configured domain (`cms.config.sites`) enables Amplify Hosting CDN caching; multiple domains force it off. Plan performance work accordingly.
101
+ - **The AppSync public API key is shipped in `amplify_outputs.json` and visible to any site visitor.** Treat it as a low-trust credential — its only privilege is reading published posts. Auto-rotated monthly by the `api-key-renewer` Lambda; no manual rotation needed.
102
+ - **The first registered user becomes admin.** Subsequent role changes go through the Cognito console (see RUNBOOK).
103
+
104
+ ## See also
105
+
106
+ - `README.md` — day-to-day usage for site owners.
107
+ - `RUNBOOK.md` — occasional ops procedures (key rotation, backup restore, etc.).
108
+ - `themes/<name>/README.md` — per-theme customization details.
@@ -6,6 +6,8 @@
6
6
 
7
7
  この README は、サイト運営者として日常的に知っておくべき内容をまとめたものです。たまにやる運用手順(API キーのローテーション、バックアップ復元など)は [RUNBOOK.ja.md](./RUNBOOK.ja.md) に置いています。テーマごとのカスタマイズ詳細は `themes/<name>/README.ja.md` を参照してください。
8
8
 
9
+ このプロジェクトで AI コーディングエージェント(Claude Code, Cursor, Codex など)を使うなら [AGENTS.ja.md](./AGENTS.ja.md) を読ませてください。エージェントが触っていい場所・ダメな場所がそこに書いてあります。
10
+
9
11
  ## 必要なもの
10
12
 
11
13
  - **Node.js 20+** と **npm**
@@ -6,6 +6,8 @@ Your site is built with [ampless](https://github.com/heavymoons/ampless) — a s
6
6
 
7
7
  This README covers what you, the site owner, need to know day-to-day. Operational recipes (rotating keys, restoring backups, etc.) live in [RUNBOOK.md](./RUNBOOK.md). Per-theme customization details live in `themes/<name>/README.md`.
8
8
 
9
+ If you use an AI coding agent (Claude Code, Cursor, Codex, etc.) on this project, point it at [AGENTS.md](./AGENTS.md) — that file tells the agent what it can and can't touch.
10
+
9
11
  ## Requirements
10
12
 
11
13
  - **Node.js 20+** and **npm**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ampless",
3
- "version": "0.2.0-alpha.19",
3
+ "version": "0.2.0-alpha.20",
4
4
  "description": "Create a new ampless project",
5
5
  "license": "MIT",
6
6
  "type": "module",