create-ampless 0.2.0-alpha.8 → 1.0.0-alpha.100

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.
Files changed (140) hide show
  1. package/README.ja.md +77 -0
  2. package/README.md +6 -3
  3. package/dist/index.js +1282 -93
  4. package/dist/templates/_shared/AGENTS.ja.md +94 -0
  5. package/dist/templates/_shared/AGENTS.md +94 -0
  6. package/dist/templates/_shared/README.ja.md +239 -0
  7. package/dist/templates/_shared/README.md +239 -0
  8. package/dist/templates/_shared/RUNBOOK.ja.md +120 -0
  9. package/dist/templates/_shared/RUNBOOK.md +32 -58
  10. package/dist/templates/_shared/THEMES.ja.md +495 -0
  11. package/dist/templates/_shared/THEMES.md +523 -0
  12. package/dist/templates/_shared/amplify/auth/post-confirmation/resource.ts +7 -0
  13. package/dist/templates/_shared/amplify/backend.custom.ts +41 -0
  14. package/dist/templates/_shared/amplify/backend.ts +20 -2
  15. package/dist/templates/_shared/amplify/data/get-media-by-src.js +45 -0
  16. package/dist/templates/_shared/amplify/data/get-published-post.js +9 -12
  17. package/dist/templates/_shared/amplify/data/list-posts-by-tag.js +6 -9
  18. package/dist/templates/_shared/amplify/data/list-published-posts.js +10 -11
  19. package/dist/templates/_shared/amplify/data/resource.custom.ts +32 -0
  20. package/dist/templates/_shared/amplify/data/resource.ts +32 -15
  21. package/dist/templates/_shared/amplify/events/dispatcher/resource.ts +1 -0
  22. package/dist/templates/_shared/amplify/events/processor-trusted/resource.ts +1 -0
  23. package/dist/templates/_shared/amplify/events/processor-untrusted/resource.ts +5 -0
  24. package/dist/templates/_shared/amplify/functions/api-key-renewer/resource.ts +1 -0
  25. package/dist/templates/_shared/amplify/functions/mcp-handler/handler.ts +1 -0
  26. package/dist/templates/_shared/amplify/functions/mcp-handler/resource.ts +12 -0
  27. package/dist/templates/_shared/amplify/functions/plugin-secret-handler/handler.ts +11 -0
  28. package/dist/templates/_shared/amplify/functions/plugin-secret-handler/resource.ts +12 -0
  29. package/dist/templates/_shared/amplify/functions/user-admin/handler.ts +4 -0
  30. package/dist/templates/_shared/amplify/functions/user-admin/resource.ts +13 -0
  31. package/dist/templates/_shared/amplify/secrets/.gitkeep +0 -0
  32. package/dist/templates/_shared/amplify/secrets/encryption-key.ts +9 -0
  33. package/dist/templates/_shared/app/(admin)/admin/mcp-tokens/page.tsx +5 -0
  34. package/dist/templates/_shared/app/(admin)/admin/plugins/page.tsx +5 -0
  35. package/dist/templates/_shared/app/(admin)/admin/users/page.tsx +5 -0
  36. package/dist/templates/_shared/app/globals.css +55 -39
  37. package/dist/templates/_shared/app/layout.tsx +51 -16
  38. package/dist/templates/_shared/app/providers.tsx +0 -2
  39. package/dist/templates/_shared/app/raw/[slug]/route.ts +10 -0
  40. package/dist/templates/_shared/app/static/[slug]/[[...path]]/route.ts +14 -0
  41. package/dist/templates/_shared/cms.config.ts +64 -23
  42. package/dist/templates/_shared/components/site-chrome/site-sidebar.tsx +3 -4
  43. package/dist/templates/_shared/components/tag-list.tsx +9 -2
  44. package/dist/templates/_shared/components.json +1 -1
  45. package/dist/templates/_shared/docs/plugin-author-guide.ja.md +934 -0
  46. package/dist/templates/_shared/docs/plugin-author-guide.md +1336 -0
  47. package/dist/templates/_shared/lib/admin.ts +12 -12
  48. package/dist/templates/_shared/lib/ampless.ts +2 -8
  49. package/dist/templates/_shared/lib/amplify.ts +0 -5
  50. package/dist/templates/_shared/package.json +51 -40
  51. package/dist/templates/_shared/plugins/README.ja.md +139 -0
  52. package/dist/templates/_shared/plugins/README.md +143 -0
  53. package/dist/templates/_shared/proxy.ts +23 -8
  54. package/dist/templates/blog/README.ja.md +22 -0
  55. package/dist/templates/blog/README.md +17 -47
  56. package/dist/templates/blog/manifest.ts +1 -1
  57. package/dist/templates/blog/pages/feed.ts +4 -5
  58. package/dist/templates/blog/pages/home.tsx +10 -15
  59. package/dist/templates/blog/pages/post.tsx +42 -14
  60. package/dist/templates/blog/pages/sitemap.ts +4 -5
  61. package/dist/templates/blog/pages/tag.tsx +8 -10
  62. package/dist/templates/blog/tokens.css +26 -40
  63. package/dist/templates/corporate/README.ja.md +18 -0
  64. package/dist/templates/corporate/README.md +12 -14
  65. package/dist/templates/corporate/pages/feed.ts +3 -4
  66. package/dist/templates/corporate/pages/home.tsx +7 -12
  67. package/dist/templates/corporate/pages/post.tsx +20 -14
  68. package/dist/templates/corporate/pages/sitemap.ts +3 -4
  69. package/dist/templates/corporate/pages/tag.tsx +8 -10
  70. package/dist/templates/corporate/tokens.css +17 -39
  71. package/dist/templates/dads/README.ja.md +31 -0
  72. package/dist/templates/dads/README.md +13 -17
  73. package/dist/templates/dads/pages/feed.ts +3 -4
  74. package/dist/templates/dads/pages/home.tsx +7 -12
  75. package/dist/templates/dads/pages/post.tsx +20 -14
  76. package/dist/templates/dads/pages/sitemap.ts +3 -4
  77. package/dist/templates/dads/pages/tag.tsx +8 -10
  78. package/dist/templates/dads/tokens.css +22 -42
  79. package/dist/templates/docs/README.ja.md +24 -0
  80. package/dist/templates/docs/README.md +10 -13
  81. package/dist/templates/docs/pages/feed.ts +3 -4
  82. package/dist/templates/docs/pages/home.tsx +6 -9
  83. package/dist/templates/docs/pages/post.tsx +19 -13
  84. package/dist/templates/docs/pages/sitemap.ts +3 -4
  85. package/dist/templates/docs/pages/tag.tsx +8 -10
  86. package/dist/templates/docs/tokens.css +17 -39
  87. package/dist/templates/landing/README.ja.md +20 -0
  88. package/dist/templates/landing/README.md +14 -19
  89. package/dist/templates/landing/pages/feed.ts +4 -5
  90. package/dist/templates/landing/pages/home.tsx +7 -12
  91. package/dist/templates/landing/pages/post.tsx +20 -14
  92. package/dist/templates/landing/pages/sitemap.ts +3 -4
  93. package/dist/templates/landing/pages/tag.tsx +8 -10
  94. package/dist/templates/landing/tokens.css +17 -39
  95. package/dist/templates/minimal/README.ja.md +14 -0
  96. package/dist/templates/minimal/README.md +9 -47
  97. package/dist/templates/minimal/pages/feed.ts +4 -5
  98. package/dist/templates/minimal/pages/home.tsx +6 -8
  99. package/dist/templates/minimal/pages/post.tsx +19 -12
  100. package/dist/templates/minimal/pages/sitemap.ts +4 -5
  101. package/dist/templates/minimal/pages/tag.tsx +7 -8
  102. package/dist/templates/minimal/tokens.css +17 -39
  103. package/dist/templates/plugin-local/README.md +34 -0
  104. package/dist/templates/plugin-local/index.ts +39 -0
  105. package/dist/templates/plugin-standalone/CHANGELOG.md +1 -0
  106. package/dist/templates/plugin-standalone/README.ja.md +43 -0
  107. package/dist/templates/plugin-standalone/README.md +43 -0
  108. package/dist/templates/plugin-standalone/package.json +47 -0
  109. package/dist/templates/plugin-standalone/src/index.test.ts +16 -0
  110. package/dist/templates/plugin-standalone/src/index.ts +29 -0
  111. package/dist/templates/plugin-standalone/tsconfig.json +16 -0
  112. package/dist/templates/plugin-standalone/tsup.config.ts +8 -0
  113. package/package.json +1 -1
  114. package/dist/templates/_shared/app/(admin)/admin/sites/page.tsx +0 -5
  115. package/dist/templates/_shared/app/site/[siteId]/raw/[slug]/route.ts +0 -5
  116. package/dist/templates/_shared/components/i18n-provider.tsx +0 -15
  117. package/dist/templates/_shared/lib/admin-site-client.ts +0 -10
  118. package/dist/templates/_shared/lib/admin-site.ts +0 -12
  119. package/dist/templates/_shared/lib/amplify-server.ts +0 -7
  120. package/dist/templates/_shared/lib/auth-server.ts +0 -15
  121. package/dist/templates/_shared/lib/cn.ts +0 -5
  122. package/dist/templates/_shared/lib/i18n.ts +0 -35
  123. package/dist/templates/_shared/lib/kv-provider.ts +0 -7
  124. package/dist/templates/_shared/lib/media.ts +0 -6
  125. package/dist/templates/_shared/lib/posts-provider.ts +0 -7
  126. package/dist/templates/_shared/lib/posts-public.ts +0 -27
  127. package/dist/templates/_shared/lib/posts.ts +0 -12
  128. package/dist/templates/_shared/lib/seo.ts +0 -11
  129. package/dist/templates/_shared/lib/site-settings.ts +0 -11
  130. package/dist/templates/_shared/lib/storage.ts +0 -10
  131. package/dist/templates/_shared/lib/theme-actions.ts +0 -5
  132. package/dist/templates/_shared/lib/theme-active.ts +0 -10
  133. package/dist/templates/_shared/lib/theme-config.ts +0 -12
  134. package/dist/templates/_shared/lib/upload.ts +0 -6
  135. /package/dist/templates/_shared/app/{site/[siteId]/[slug] → [slug]}/page.tsx +0 -0
  136. /package/dist/templates/_shared/app/{site/[siteId]/feed.xml → feed.xml}/route.ts +0 -0
  137. /package/dist/templates/_shared/app/{site/[siteId]/og → og}/[slug]/route.ts +0 -0
  138. /package/dist/templates/_shared/app/{site/[siteId]/page.tsx → page.tsx} +0 -0
  139. /package/dist/templates/_shared/app/{site/[siteId]/sitemap.xml → sitemap.xml}/route.ts +0 -0
  140. /package/dist/templates/_shared/app/{site/[siteId]/tag → tag}/[tag]/page.tsx +0 -0
@@ -1,6 +1,12 @@
1
1
  import { defineConfig } from 'ampless'
2
2
  import seoPlugin from '@ampless/plugin-seo'
3
3
  import rssPlugin from '@ampless/plugin-rss'
4
+ // import schemaJsonLdPlugin from '@ampless/plugin-schema-jsonld'
5
+ // import readingTimePlugin from '@ampless/plugin-reading-time'
6
+ // import cookieConsentPlugin from '@ampless/plugin-cookie-consent'
7
+ // import analyticsGa4Plugin from '@ampless/plugin-analytics-ga4'
8
+ // import gtmPlugin from '@ampless/plugin-gtm'
9
+ // import plausiblePlugin from '@ampless/plugin-plausible'
4
10
  // import webhookPlugin from '@ampless/plugin-webhook'
5
11
  // import ogImagePlugin, { loadFontFromUrl } from '@ampless/plugin-og-image'
6
12
 
@@ -27,29 +33,7 @@ export default defineConfig({
27
33
  losslessForPng: true,
28
34
  },
29
35
  },
30
- // Multi-site config. Leave undefined for single-site operation; the
31
- // runtime then serves every request as siteId='default'. To run
32
- // multiple sites in one Amplify environment, declare two or more
33
- // entries here:
34
- //
35
- // sites: {
36
- // blog: {
37
- // domains: ['blog.example.com', 'www.example.com'],
38
- // name: 'My Blog',
39
- // url: 'https://blog.example.com',
40
- // },
41
- // docs: {
42
- // domains: ['docs.example.com'],
43
- // name: 'Docs',
44
- // url: 'https://docs.example.com',
45
- // },
46
- // },
47
- //
48
- // In multi-site mode the middleware forces `Cache-Control: private,
49
- // no-store` on public responses (Amplify Hosting's CloudFront cache
50
- // key cannot disambiguate by Host). Single-site mode leaves caching
51
- // to the default page directives.
52
-
36
+ // Date display format.
53
37
  // 'iso' — YYYY-MM-DD (default; SSR-safe, locale-neutral)
54
38
  // 'long' — "April 27, 2026" (en-US)
55
39
  // 'locale' — browser/server locale
@@ -90,6 +74,63 @@ export default defineConfig({
90
74
  // ],
91
75
  // }),
92
76
  //
77
+ // Cookie consent banner. Installs `window.amplessConsent` so other
78
+ // plugins can gate themselves on user consent (see the Consent
79
+ // Convention in `docs/architecture/08-plugin-architecture.md`).
80
+ //
81
+ // IMPORTANT: cookieConsentPlugin() must come BEFORE any analytics
82
+ // plugin in this array — both run `afterInteractive` and the consent
83
+ // API must be installed before analytics scripts read it. (Analytics
84
+ // plugins also wait for `ampless:consent-ready`, so out-of-order
85
+ // registration still works, but in-order is faster.)
86
+ //
87
+ // Categories (analytics / marketing / etc.) are managed live from
88
+ // `/admin/plugins`. Banner text and button labels are also admin-editable.
89
+ //
90
+ // cookieConsentPlugin(),
91
+ //
92
+ // Reading-time badge. Estimates read time from the post body and injects
93
+ // a configurable label (default: "3 min read") before or after the post
94
+ // content. Supports English word count + CJK character count (÷ 2).
95
+ // Label template and position are editable from `/admin/plugins`.
96
+ //
97
+ // readingTimePlugin(),
98
+ //
99
+ // Google Analytics 4. Once registered here, the measurement ID can be
100
+ // edited from `/admin/plugins` without a redeploy — the constructor
101
+ // value below is just the initial default. Pass an empty string to
102
+ // disable the GA tag entirely. See packages/ampless/docs/plugin-author-guide.md.
103
+ //
104
+ // analyticsGa4Plugin({
105
+ // measurementId: '', // 'G-XXXXXXXX' to enable
106
+ // }),
107
+ //
108
+ // Google Tag Manager. Like GA4, the container ID is editable from
109
+ // `/admin/plugins` after deploy. Tags fire via GTM's own trigger model.
110
+ //
111
+ // gtmPlugin({
112
+ // containerId: '', // 'GTM-XXXXXXX' to enable
113
+ // }),
114
+ //
115
+ // Plausible Analytics (privacy-focused, typically no cookie consent
116
+ // required). `domain` matches the registered Plausible site.
117
+ // `scriptUrl` defaults to plausible.io; override for self-hosted.
118
+ //
119
+ // plausiblePlugin({
120
+ // domain: '', // 'example.com' to enable
121
+ // }),
122
+ //
123
+ // JSON-LD structured data (Schema.org). Injects <script type="application/ld+json">
124
+ // into post pages for Article / BlogPosting markup. articleType, authorName and
125
+ // publisherName fall back to the site name when left empty.
126
+ //
127
+ // schemaJsonLdPlugin({
128
+ // articleType: 'Article', // 'Article' | 'BlogPosting' | 'NewsArticle'
129
+ // authorName: '', // empty falls back to site.name
130
+ // publisherName: '', // empty falls back to site.name
131
+ // publisherLogo: '', // optional absolute URL to publisher logo
132
+ // }),
133
+ //
93
134
  // Per-post OG images: SNS crawlers hit `/og/<slug>` and we render
94
135
  // a JSX card → PNG via Next.js `ImageResponse`. Requires at least one
95
136
  // font — ship a .ttf from your CDN or `/public` directory.
@@ -1,10 +1,9 @@
1
1
  import Link from 'next/link'
2
2
  import { parseLinkList, isTagListUrl } from 'ampless'
3
- import { listPostsByTag } from '@/lib/posts-public'
3
+ import { ampless } from '@/lib/ampless'
4
4
 
5
5
  interface Props {
6
6
  links: string | undefined
7
- siteId: string
8
7
  className?: string
9
8
  }
10
9
 
@@ -19,7 +18,7 @@ interface Props {
19
18
  * paired with `force-dynamic` on the page so fresh content shows up
20
19
  * after publish events.
21
20
  */
22
- export async function SiteSidebar({ links, siteId, className }: Props) {
21
+ export async function SiteSidebar({ links, className }: Props) {
23
22
  const items = parseLinkList(links)
24
23
  if (items.length === 0) return null
25
24
 
@@ -28,7 +27,7 @@ export async function SiteSidebar({ links, siteId, className }: Props) {
28
27
  items.map(async (item) => {
29
28
  const tagRef = isTagListUrl(item.url)
30
29
  if (!tagRef) return { type: 'link' as const, label: item.label, url: item.url }
31
- const { items: posts } = await listPostsByTag(tagRef.tag, { siteId, limit: 50 })
30
+ const { items: posts } = await ampless.listPostsByTag(tagRef.tag, { limit: 50 })
32
31
  return {
33
32
  type: 'tagSection' as const,
34
33
  label: item.label,
@@ -3,14 +3,18 @@ import Link from 'next/link'
3
3
  interface TagListProps {
4
4
  tags?: string[] | null
5
5
  className?: string
6
+ /** Cap the number of tags shown; the rest collapse into a "+N" indicator. */
7
+ max?: number
6
8
  }
7
9
 
8
10
  // Renders post tags as chip-style links to /tag/[tag]. Pure-server, no JS.
9
- export function TagList({ tags, className }: TagListProps) {
11
+ export function TagList({ tags, className, max }: TagListProps) {
10
12
  if (!tags?.length) return null
13
+ const shown = max != null ? tags.slice(0, max) : tags
14
+ const overflow = tags.length - shown.length
11
15
  return (
12
16
  <ul className={`flex flex-wrap gap-2 ${className ?? ''}`}>
13
- {tags.map((tag) => (
17
+ {shown.map((tag) => (
14
18
  <li key={tag}>
15
19
  <Link
16
20
  href={`/tag/${encodeURIComponent(tag)}`}
@@ -20,6 +24,9 @@ export function TagList({ tags, className }: TagListProps) {
20
24
  </Link>
21
25
  </li>
22
26
  ))}
27
+ {overflow > 0 && (
28
+ <li className="inline-block px-2 py-0.5 text-xs text-muted-foreground">+{overflow}</li>
29
+ )}
23
30
  </ul>
24
31
  )
25
32
  }
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "aliases": {
14
14
  "components": "@/components",
15
- "utils": "@/lib/cn",
15
+ "utils": "@ampless/runtime/ui",
16
16
  "ui": "@/components/ui",
17
17
  "lib": "@/lib",
18
18
  "hooks": "@/hooks"