@hutusi/amytis 1.5.5

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 (179) hide show
  1. package/.github/workflows/ci.yml +33 -0
  2. package/.github/workflows/publish.yml +53 -0
  3. package/AGENTS.md +41 -0
  4. package/CLAUDE.md +200 -0
  5. package/GEMINI.md +84 -0
  6. package/README.md +172 -0
  7. package/TODO.md +76 -0
  8. package/bun.lock +1530 -0
  9. package/content/about.mdx +23 -0
  10. package/content/books/sample-book/index.mdx +24 -0
  11. package/content/books/sample-book/introduction.mdx +34 -0
  12. package/content/books/sample-book/setup.mdx +48 -0
  13. package/content/books/sample-book/writing-content.mdx +49 -0
  14. package/content/flows/2026/02/05.md +8 -0
  15. package/content/flows/2026/02/10.mdx +8 -0
  16. package/content/flows/2026/02/15.md +8 -0
  17. package/content/flows/2026/02/18.mdx +14 -0
  18. package/content/posts/2026-01-12-the-art-of-algorithms.mdx +49 -0
  19. package/content/posts/2026-01-15-nested-image-test/images/test.svg +5 -0
  20. package/content/posts/2026-01-15-nested-image-test/index.mdx +27 -0
  21. package/content/posts/2026-01-21-kitchen-sink/assets/test.svg +5 -0
  22. package/content/posts/2026-01-21-kitchen-sink/index.mdx +169 -0
  23. package/content/posts/asynchronous-javascript.mdx +49 -0
  24. package/content/posts/draft-post.mdx +13 -0
  25. package/content/posts/future-post.mdx +12 -0
  26. package/content/posts/legacy-markdown.md +60 -0
  27. package/content/posts/markdown-features.mdx +78 -0
  28. package/content/posts/modern-css-layouts.mdx +45 -0
  29. package/content/posts/multilingual-test.mdx +124 -0
  30. package/content/posts/syntax-highlighting-showcase.mdx +528 -0
  31. package/content/posts/understanding-react-hooks.mdx +48 -0
  32. package/content/posts/welcome-to-amytis.mdx +21 -0
  33. package/content/posts//344/270/255/346/226/207/346/265/213/350/257/225/346/226/207/347/253/240.mdx +54 -0
  34. package/content/series/ai-nexus-weekly/index.mdx +10 -0
  35. package/content/series/ai-nexus-weekly/week-1.mdx +20 -0
  36. package/content/series/ai-nexus-weekly/week-10.mdx +20 -0
  37. package/content/series/ai-nexus-weekly/week-11.mdx +20 -0
  38. package/content/series/ai-nexus-weekly/week-12.mdx +20 -0
  39. package/content/series/ai-nexus-weekly/week-2.mdx +20 -0
  40. package/content/series/ai-nexus-weekly/week-3.mdx +20 -0
  41. package/content/series/ai-nexus-weekly/week-4.mdx +20 -0
  42. package/content/series/ai-nexus-weekly/week-5.mdx +20 -0
  43. package/content/series/ai-nexus-weekly/week-6.mdx +20 -0
  44. package/content/series/ai-nexus-weekly/week-7.mdx +20 -0
  45. package/content/series/ai-nexus-weekly/week-8.mdx +20 -0
  46. package/content/series/ai-nexus-weekly/week-9.mdx +20 -0
  47. package/content/series/digital-garden/01-philosophy/index.mdx +23 -0
  48. package/content/series/digital-garden/01-philosophy.mdx +30 -0
  49. package/content/series/digital-garden/02-architecture.mdx +19 -0
  50. package/content/series/digital-garden/index.mdx +11 -0
  51. package/content/series/markdown-showcase/index.mdx +11 -0
  52. package/content/series/markdown-showcase/mathematical-notation.mdx +32 -0
  53. package/content/series/markdown-showcase/syntax-highlighting.mdx +119 -0
  54. package/content/series/markdown-showcase/visuals-and-diagrams.mdx +27 -0
  55. package/content/series/nextjs-deep-dive/01-getting-started.mdx +66 -0
  56. package/content/series/nextjs-deep-dive/02-routing-mastery/assets/diagram.svg +8 -0
  57. package/content/series/nextjs-deep-dive/02-routing-mastery/assets/m-p-model.png +0 -0
  58. package/content/series/nextjs-deep-dive/02-routing-mastery/index.mdx +138 -0
  59. package/content/series/nextjs-deep-dive/index.mdx +12 -0
  60. package/docs/ARCHITECTURE.md +103 -0
  61. package/docs/CONTRIBUTING.md +86 -0
  62. package/docs/deployment.md +319 -0
  63. package/eslint.config.mjs +18 -0
  64. package/next.config.ts +25 -0
  65. package/package.json +81 -0
  66. package/postcss.config.mjs +7 -0
  67. package/public/file.svg +1 -0
  68. package/public/globe.svg +1 -0
  69. package/public/icon.svg +9 -0
  70. package/public/logo.svg +11 -0
  71. package/public/next-image-export-optimizer-hashes.json +7 -0
  72. package/public/next.svg +1 -0
  73. package/public/screenshot.png +0 -0
  74. package/public/vercel.svg +1 -0
  75. package/public/window.svg +1 -0
  76. package/scripts/copy-assets.ts +211 -0
  77. package/scripts/new-flow.ts +47 -0
  78. package/scripts/new-from-images.ts +141 -0
  79. package/scripts/new-from-pdf.ts +105 -0
  80. package/scripts/new-post.ts +98 -0
  81. package/scripts/new-series.ts +40 -0
  82. package/scripts/series-draft.ts +136 -0
  83. package/site.config.ts +91 -0
  84. package/src/app/[slug]/page.tsx +67 -0
  85. package/src/app/archive/page.tsx +147 -0
  86. package/src/app/authors/[author]/page.tsx +210 -0
  87. package/src/app/books/[slug]/[chapter]/page.tsx +54 -0
  88. package/src/app/books/[slug]/page.tsx +156 -0
  89. package/src/app/books/page.tsx +63 -0
  90. package/src/app/favicon.ico +0 -0
  91. package/src/app/feed.xml/route.ts +44 -0
  92. package/src/app/flows/[year]/[month]/[day]/page.tsx +105 -0
  93. package/src/app/flows/[year]/[month]/page.tsx +72 -0
  94. package/src/app/flows/[year]/page.tsx +82 -0
  95. package/src/app/flows/page/[page]/page.tsx +63 -0
  96. package/src/app/flows/page.tsx +38 -0
  97. package/src/app/globals.css +406 -0
  98. package/src/app/layout.tsx +114 -0
  99. package/src/app/page/[page]/page.tsx +60 -0
  100. package/src/app/page.tsx +110 -0
  101. package/src/app/posts/[slug]/page.tsx +119 -0
  102. package/src/app/posts/page/[page]/page.tsx +58 -0
  103. package/src/app/posts/page.tsx +40 -0
  104. package/src/app/search.json/route.ts +49 -0
  105. package/src/app/series/[slug]/page/[page]/page.tsx +141 -0
  106. package/src/app/series/[slug]/page.tsx +139 -0
  107. package/src/app/series/page.tsx +96 -0
  108. package/src/app/sitemap.ts +112 -0
  109. package/src/app/tags/[tag]/page.tsx +76 -0
  110. package/src/app/tags/page.tsx +37 -0
  111. package/src/components/Analytics.tsx +49 -0
  112. package/src/components/AuthorStats.tsx +34 -0
  113. package/src/components/BookMobileNav.tsx +171 -0
  114. package/src/components/BookSidebar.tsx +275 -0
  115. package/src/components/CodeBlock.tsx +110 -0
  116. package/src/components/Comments.tsx +63 -0
  117. package/src/components/CoverImage.tsx +93 -0
  118. package/src/components/CuratedSeriesSection.tsx +124 -0
  119. package/src/components/ExternalLinks.tsx +45 -0
  120. package/src/components/FeaturedStoriesSection.tsx +106 -0
  121. package/src/components/FlowCalendarSidebar.tsx +249 -0
  122. package/src/components/FlowContent.tsx +96 -0
  123. package/src/components/FlowTimelineEntry.tsx +34 -0
  124. package/src/components/Footer.tsx +104 -0
  125. package/src/components/Hero.tsx +126 -0
  126. package/src/components/HorizontalScroll.tsx +128 -0
  127. package/src/components/LanguageProvider.tsx +80 -0
  128. package/src/components/LanguageSwitch.tsx +17 -0
  129. package/src/components/LatestWritingSection.tsx +45 -0
  130. package/src/components/MarkdownRenderer.tsx +135 -0
  131. package/src/components/Mermaid.tsx +89 -0
  132. package/src/components/Navbar.tsx +243 -0
  133. package/src/components/PageHeader.tsx +39 -0
  134. package/src/components/Pagination.tsx +120 -0
  135. package/src/components/PostCard.tsx +30 -0
  136. package/src/components/PostList.tsx +104 -0
  137. package/src/components/PostSidebar.tsx +225 -0
  138. package/src/components/ReadingProgressBar.tsx +37 -0
  139. package/src/components/RecentNotesSection.tsx +56 -0
  140. package/src/components/RelatedPosts.tsx +34 -0
  141. package/src/components/Search.tsx +151 -0
  142. package/src/components/SelectedBooksSection.tsx +80 -0
  143. package/src/components/SeriesCatalog.tsx +112 -0
  144. package/src/components/SeriesList.tsx +167 -0
  145. package/src/components/SeriesSidebar.tsx +132 -0
  146. package/src/components/SimpleLayoutHeader.tsx +38 -0
  147. package/src/components/Skeleton.tsx +131 -0
  148. package/src/components/TableOfContents.tsx +158 -0
  149. package/src/components/Tag.tsx +47 -0
  150. package/src/components/TagPageHeader.tsx +38 -0
  151. package/src/components/ThemeProvider.tsx +12 -0
  152. package/src/components/ThemeToggle.tsx +68 -0
  153. package/src/components/TranslatedText.tsx +13 -0
  154. package/src/fonts/Inter-Bold.woff2 +0 -0
  155. package/src/fonts/Inter-Regular.woff2 +0 -0
  156. package/src/fonts/LibreBaskerville-Bold.ttf +0 -0
  157. package/src/fonts/LibreBaskerville-Italic.ttf +0 -0
  158. package/src/fonts/LibreBaskerville-Regular.ttf +0 -0
  159. package/src/i18n/translations.ts +135 -0
  160. package/src/layouts/BookLayout.tsx +109 -0
  161. package/src/layouts/PostLayout.tsx +118 -0
  162. package/src/layouts/SimpleLayout.tsx +31 -0
  163. package/src/lib/i18n.ts +35 -0
  164. package/src/lib/markdown.test.ts +127 -0
  165. package/src/lib/markdown.ts +1067 -0
  166. package/src/lib/rehype-image-metadata.ts +54 -0
  167. package/src/lib/shuffle.ts +11 -0
  168. package/templates/default.mdx +13 -0
  169. package/tests/e2e/navigation.test.ts +51 -0
  170. package/tests/e2e/series-routes.test.ts +63 -0
  171. package/tests/e2e/smoke.test.ts +19 -0
  172. package/tests/integration/markdown-features.test.ts +54 -0
  173. package/tests/integration/posts.test.ts +57 -0
  174. package/tests/integration/reading-time-headings.test.ts +79 -0
  175. package/tests/integration/series-draft.test.ts +46 -0
  176. package/tests/integration/series.test.ts +79 -0
  177. package/tests/tooling/new-from-images.test.ts +173 -0
  178. package/tests/tooling/new-post.test.ts +72 -0
  179. package/tsconfig.json +34 -0
@@ -0,0 +1,33 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ build-and-test:
11
+ name: Build & Test
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - name: Checkout repository
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Setup Bun
19
+ uses: oven-sh/setup-bun@v1
20
+ with:
21
+ bun-version: latest
22
+
23
+ - name: Install dependencies
24
+ run: bun install --frozen-lockfile
25
+
26
+ - name: Lint
27
+ run: bun run lint
28
+
29
+ - name: Run Tests
30
+ run: bun test
31
+
32
+ - name: Build
33
+ run: bun run build:dev
@@ -0,0 +1,53 @@
1
+ name: Publish to npm and GitHub Packages
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ publish-npm:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ id-token: write # Required for Trusted Publishing
12
+ contents: read
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: 'lts/*'
18
+ registry-url: 'https://registry.npmjs.org'
19
+
20
+ - uses: oven-sh/setup-bun@v1
21
+ with:
22
+ bun-version: latest
23
+
24
+ - run: bun install --frozen-lockfile
25
+
26
+ - name: Publish to npm
27
+ # No NODE_AUTH_TOKEN needed for Trusted Publishing!
28
+ # --provenance proves that the package was built in this GitHub Action
29
+ run: npm publish --provenance --access public
30
+
31
+ publish-github:
32
+ runs-on: ubuntu-latest
33
+ permissions:
34
+ contents: read
35
+ packages: write
36
+ steps:
37
+ - uses: actions/checkout@v4
38
+ - uses: actions/setup-node@v4
39
+ with:
40
+ node-version: 'lts/*'
41
+ registry-url: 'https://npm.pkg.github.com'
42
+ scope: '@hutusi'
43
+
44
+ - uses: oven-sh/setup-bun@v1
45
+ with:
46
+ bun-version: latest
47
+
48
+ - run: bun install --frozen-lockfile
49
+
50
+ - name: Publish to GitHub
51
+ run: npm publish
52
+ env:
53
+ NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package/AGENTS.md ADDED
@@ -0,0 +1,41 @@
1
+ # Repository Guidelines
2
+
3
+ ## Project Structure & Module Organization
4
+ - `src/app/`: Next.js App Router pages and route handlers (`posts`, `series`, `tags`, `authors`, feeds, sitemap).
5
+ - `src/components/`: Reusable UI building blocks (cards, navigation, search, i18n/theme controls).
6
+ - `src/lib/`: Content parsing and shared logic (`markdown.ts`, i18n helpers, rehype utilities).
7
+ - `content/posts/`, `content/series/`: Markdown/MDX source content. Use folder posts (`index.mdx` + `images/` or `assets/`) when media is co-located.
8
+ - `tests/`: Integration/e2e/tooling suites; keep focused utility tests near source (example: `src/lib/markdown.test.ts`).
9
+ - `scripts/`: Bun-based authoring/import tooling.
10
+
11
+ ## Build, Test, and Development Commands
12
+ - `bun install`: Install dependencies.
13
+ - `bun dev`: Run local dev server at `http://localhost:3000`.
14
+ - `bun run build`: Production export build (asset copy + Next build + image optimizer).
15
+ - `bun run build:dev`: Build without export image optimization.
16
+ - `bun run clean`: Remove generated outputs (`.next`, `out`, `public/posts`).
17
+ - `bun run lint`: Run ESLint.
18
+ - `bun test` / `bun run test:unit` / `bun run test:int` / `bun run test:e2e`: Run all or scoped tests.
19
+
20
+ ## Coding Style & Naming Conventions
21
+ - Use TypeScript for app and utility code; MDX/Markdown for content.
22
+ - Match existing file style and let ESLint enforce consistency.
23
+ - Naming: components in PascalCase (`PostCard.tsx`), helpers in camelCase (`getAuthorSlug`), content slugs in kebab-case unless intentionally Unicode.
24
+ - Keep business logic in `src/lib/` and keep route files thin.
25
+
26
+ ## Static Export Route Rules (Important)
27
+ - Project uses `output: "export"` and `trailingSlash: true` in `next.config.ts`.
28
+ - In `generateStaticParams()`, return raw segment values; do not pre-encode with `encodeURIComponent`.
29
+ - Never link to route placeholders like `/posts/[slug]`; always link to concrete slugs (for example, `/posts/中文测试文章`).
30
+ - When touching dynamic routes, verify both ASCII and Unicode paths.
31
+
32
+ ## Testing Guidelines
33
+ - Test framework: Bun (`bun:test`). File pattern: `*.test.ts`.
34
+ - Add tests when changing slug resolution, content parsing, routing, or scaffolding scripts.
35
+ - Before PR: run `bun run lint && bun test && bun run build:dev`.
36
+
37
+ ## Commit & Pull Request Guidelines
38
+ - Follow Conventional Commits used in history (`feat:`, `fix:`, `refactor:`, `docs:`, `release:`).
39
+ - Keep commits single-purpose and include impacted paths in PR description.
40
+ - PRs should include intent, validation steps, and screenshots for UI changes.
41
+ - CI must pass (`bun install --frozen-lockfile`, lint, test, build).
package/CLAUDE.md ADDED
@@ -0,0 +1,200 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ Amytis is a static "digital garden" blog built with Next.js 15+ (App Router), React 19, and Tailwind CSS v4. Content is authored in MDX/Markdown files and statically generated at build time. Features include series support, multi-language (i18n), configurable themes, and comments integration.
8
+
9
+ ## Commands
10
+
11
+ ```bash
12
+ # Development
13
+ bun dev # Start dev server at localhost:3000
14
+ bun run lint # Run ESLint
15
+
16
+ # Testing
17
+ bun test # Run all tests
18
+ bun run test:unit # Run unit tests (src/)
19
+ bun run test:int # Run integration tests
20
+ bun run test:e2e # Run end-to-end tests
21
+ bun test path/to/file.test.ts # Run a single test file
22
+
23
+ # Build
24
+ bun run build # Full production build (copies assets, builds Next.js, optimizes images)
25
+ bun run build:dev # Development build (no image optimization, faster)
26
+ bun run clean # Remove .next, out, public/posts directories
27
+
28
+ # Content creation
29
+ bun run new "Post Title" # Create new post (flat file)
30
+ bun run new "Title" --folder # Create as folder with index.mdx
31
+ bun run new "Title" --prefix weekly # Create with prefix (e.g., weekly-title)
32
+ bun run new "Title" --template custom # Use custom template from templates/
33
+ bun run new "Title" --md # Create as .md instead of .mdx
34
+ bun run new "Title" --series my-series # Create post in content/series/my-series/
35
+ bun run new-series "Series Name" # Create new series with cover image
36
+ bun run new-from-pdf doc.pdf # Create post from PDF (converts pages to images)
37
+ bun run new-from-pdf doc.pdf --title "My Document" # With custom title
38
+ bun run new-from-pdf doc.pdf --scale 3.0 # Higher resolution (default: 2.0)
39
+ bun run new-from-images ./photos # Create post from image folder
40
+ bun run new-from-images ./photos --title "My Gallery" # With custom title
41
+ bun run new-from-images ./photos --sort date # Sort by date (default: name)
42
+ bun run new-from-images ./photos --no-copy # Reference images instead of copying
43
+ bun run new-flow # Create today's flow note (.md)
44
+ bun run new-flow "My Title" # Create flow with custom title
45
+ bun run new-flow --mdx # Use .mdx format instead
46
+ ```
47
+
48
+ ## Architecture
49
+
50
+ ### Data Flow
51
+
52
+ 1. **Content source**: MDX/Markdown files in `content/posts/` and `content/series/`
53
+ 2. **Data layer**: `src/lib/markdown.ts` - reads files with Node `fs`, parses frontmatter with `gray-matter`, validates with Zod
54
+ 3. **Static generation**: Routes use `generateStaticParams` to pre-render at build time
55
+ 4. **Rendering**: `react-markdown` with remark/rehype plugins for GFM, math (KaTeX), syntax highlighting, and Mermaid diagrams
56
+
57
+ ### Key Files
58
+
59
+ - `site.config.ts` - Site configuration (nav, social, pagination, themes, i18n, analytics, comments)
60
+ - `src/lib/markdown.ts` - Data access layer with all content query functions
61
+ - `src/app/globals.css` - Theme CSS variables and color palettes
62
+ - `src/components/MarkdownRenderer.tsx` - MDX rendering with all plugins
63
+ - `src/i18n/translations.ts` - Language strings for i18n
64
+
65
+ ### Route Structure
66
+
67
+ - `/` - Homepage with hero, featured series, featured posts, latest writing
68
+ - `/posts/[slug]` - Individual post pages
69
+ - `/posts/page/[page]` - Paginated post listing
70
+ - `/series` - All series overview
71
+ - `/series/[slug]` - Single series with its posts
72
+ - `/series/[slug]/page/[page]` - Series pagination
73
+ - `/tags` - Tag cloud with post counts
74
+ - `/tags/[tag]` - Posts filtered by tag
75
+ - `/authors/[author]` - Posts filtered by author
76
+ - `/archive` - Chronological listing grouped by year/month
77
+ - `/books` - All books overview
78
+ - `/books/[slug]` - Single book with chapter listing
79
+ - `/books/[slug]/[chapter]` - Individual chapter page
80
+ - `/flows` - Flow notes listing (paginated)
81
+ - `/flows/page/[page]` - Paginated flow listing
82
+ - `/flows/[year]` - Flows filtered by year
83
+ - `/flows/[year]/[month]` - Flows filtered by month
84
+ - `/flows/[year]/[month]/[day]` - Single flow detail page
85
+ - `/[slug]` - Static pages (about, etc.)
86
+
87
+ ### Content Structure
88
+
89
+ **Posts** support two formats:
90
+ - **Flat file**: `content/posts/my-post.mdx`
91
+ - **Nested folder**: `content/posts/my-post/index.mdx` (allows co-located images in `./images/`)
92
+
93
+ **Series** live in `content/series/[slug]/index.mdx` with optional `images/` folder for cover images.
94
+
95
+ **Books** live in `content/books/[slug]/` with `index.mdx` for metadata and separate `.mdx` files per chapter. The `index.mdx` frontmatter defines chapter ordering with an optional parts structure.
96
+
97
+ **Flows** (daily notes) live in `content/flows/YYYY/MM/DD.md` (or `.mdx`). Each flow has a date, title, excerpt, tags, and markdown content.
98
+
99
+ Date-prefixed filenames (`2026-01-01-my-post.mdx`) extract dates automatically.
100
+
101
+ ## Configuration (`site.config.ts`)
102
+
103
+ Key configuration options:
104
+ - `nav` - Navigation links with weights
105
+ - `social` - GitHub, Twitter, email links for footer
106
+ - `series.navbar` - Series slugs to show in navbar dropdown
107
+ - `pagination.posts`, `pagination.series` - Items per page
108
+ - `themeColor` - 'default' | 'blue' | 'rose' | 'amber'
109
+ - `hero` - Homepage hero title and subtitle
110
+ - `i18n` - Default locale and supported locales
111
+ - `featured.series` - Scrollable series: `scrollThreshold` (default: 2), `maxItems` (default: 6)
112
+ - `featured.stories` - Scrollable stories: `scrollThreshold` (default: 1), `maxItems` (default: 5)
113
+ - `analytics.provider` - 'umami' | 'plausible' | 'google' | null
114
+ - `comments.provider` - 'giscus' | 'disqus' | null
115
+
116
+ ## Content Frontmatter
117
+
118
+ ### Posts
119
+
120
+ ```yaml
121
+ ---
122
+ title: "Post Title"
123
+ date: "2026-01-01"
124
+ excerpt: "Optional summary (auto-generated if omitted)"
125
+ category: "Category Name"
126
+ tags: ["tag1", "tag2"]
127
+ authors: ["Author Name"]
128
+ series: "series-slug" # Link to a series
129
+ draft: true # Hidden in production
130
+ featured: true # Show in featured section
131
+ coverImage: "./images/cover.jpg" # Local or external URL
132
+ latex: true # Enable KaTeX math
133
+ toc: false # Hide table of contents
134
+ layout: "simple" # Use simple layout (default: "post")
135
+ externalLinks: # Links to external discussions
136
+ - name: "Hacker News"
137
+ url: "https://news.ycombinator.com/item?id=12345"
138
+ - name: "V2EX"
139
+ url: "https://v2ex.com/t/123456"
140
+ ---
141
+ ```
142
+
143
+ ### Series (`content/series/[slug]/index.mdx`)
144
+
145
+ ```yaml
146
+ ---
147
+ title: "Series Title"
148
+ excerpt: "Series description"
149
+ date: "2026-01-01"
150
+ coverImage: "./images/cover.jpg"
151
+ featured: true # Show in featured series
152
+ draft: true # Hidden in production (default: false)
153
+ sort: "date-asc" # 'date-asc' | 'date-desc' | 'manual'
154
+ posts: ["post-1", "post-2"] # Manual post ordering (optional)
155
+ ---
156
+ ```
157
+
158
+ ### Books (`content/books/[slug]/index.mdx`)
159
+
160
+ ```yaml
161
+ ---
162
+ title: "Book Title"
163
+ excerpt: "Book description"
164
+ date: "2026-01-01"
165
+ coverImage: "text:DG" # Cover image or text placeholder
166
+ featured: true # Show in featured books
167
+ draft: false
168
+ authors: ["Author Name"]
169
+ chapters:
170
+ - part: "Part I: Getting Started" # Optional part grouping
171
+ chapters:
172
+ - title: "Chapter Title"
173
+ file: "chapter-file" # Maps to chapter-file.mdx in same directory
174
+ - part: "Part II: Advanced"
175
+ chapters:
176
+ - title: "Another Chapter"
177
+ file: "another-chapter"
178
+ ---
179
+ ```
180
+
181
+ ## Key Components
182
+
183
+ - `PostLayout` / `SimpleLayout` - Post page layouts with TOC, series sidebar, external links, comments
184
+ - `Hero` - Configurable homepage hero section with collapsible intro
185
+ - `HorizontalScroll` - Scrollable container with navigation arrows for featured content
186
+ - `PostList` - Card-based post listing with thumbnails, metadata, excerpts, and tags
187
+ - `SeriesCatalog` - Timeline-style series post listing with numbered entries and progress indicator
188
+ - `SeriesSidebar` - Series navigation sidebar with progress bar and color-coded states
189
+ - `SeriesList` - Mobile-optimized series navigation matching sidebar design
190
+ - `Search` - Client-side fuzzy search (Cmd/Ctrl+K) using Fuse.js
191
+ - `TableOfContents` - Sticky TOC with scroll tracking, reading progress, and back-to-top
192
+ - `MarkdownRenderer` - MDX rendering with GFM, math, syntax highlighting, diagrams
193
+ - `CoverImage` - Optimized image component with WebP support
194
+ - `Comments` - Giscus or Disqus integration (theme-aware)
195
+ - `Analytics` - Umami, Plausible, or Google Analytics integration
196
+ - `FlowContent` - Client wrapper for flow pages with tag filtering state management
197
+ - `FlowCalendarSidebar` - Calendar sidebar with date navigation, browse panel, and clickable tag filters
198
+ - `FlowTimelineEntry` - Individual flow entry in timeline list
199
+ - `LanguageSwitch` - i18n language selector
200
+ - `ThemeToggle` - Light/dark mode toggle
package/GEMINI.md ADDED
@@ -0,0 +1,84 @@
1
+ # Amytis Project Context
2
+
3
+ ## Project Overview
4
+ **Amytis** is a high-performance, elegant digital garden and blog engine built with **Next.js 16 (App Router)**, **React 19**, and **Tailwind CSS v4**. It is designed for cultivating thoughts and sharing knowledge with a focus on typography, readability, and flexible content organization.
5
+
6
+ ### Main Technologies
7
+ - **Framework**: Next.js 16 (App Router)
8
+ - **Runtime/Package Manager**: [Bun](https://bun.sh/)
9
+ - **Styling**: Tailwind CSS v4 with CSS-variable based themes and `@tailwindcss/typography`.
10
+ - **Content**: Local MDX/Markdown files with Zod-validated frontmatter.
11
+ - **Search**: Client-side fuzzy search using `Fuse.js`.
12
+ - **Diagrams**: Native support for `Mermaid` diagrams.
13
+ - **Math**: LaTeX support via `rehype-katex`.
14
+
15
+ ## Building and Running
16
+
17
+ ### Development
18
+ ```bash
19
+ bun dev
20
+ ```
21
+
22
+ ### Production Build (Static Export)
23
+ ```bash
24
+ bun run build
25
+ ```
26
+ Generates a fully optimized static site in the `out/` directory.
27
+
28
+ ### Linting & Testing
29
+ ```bash
30
+ bun run lint
31
+ bun test
32
+ ```
33
+
34
+ ## Project Structure
35
+ - `src/app/`: Next.js App Router pages and global styles.
36
+ - `page.tsx`: Homepage with horizontal scrolling featured sections and latest timeline.
37
+ - `posts/`: Paginated post listing and individual post routes.
38
+ - `flows/`: Stream-style daily notes or micro-blogging (`[year]/[month]/[day]`).
39
+ - `series/`: Series overview and individual series catalog pages with pagination support.
40
+ - `archive/`: Timeline-based chronological archive grouped by year and month.
41
+ - `tags/`: Popularity-sorted tag cloud and filtered listings.
42
+ - `authors/`: Posts filtered by individual authors.
43
+ - `search.json/`: Static search index generator.
44
+ - `src/lib/`: Core logic and utilities.
45
+ - `markdown.ts`: Advanced parsing for posts/series/flows, sorting, reading time calculation (multilingual), and metadata inheritance.
46
+ - `src/components/`: Modular UI blocks (Hero, HorizontalScroll, Search, CoverImage, etc.).
47
+ - `content/`: Source Markdown/MDX content.
48
+ - `scripts/`: CLI tools for content management and asset processing.
49
+
50
+ ## Key Features & Configuration
51
+
52
+ ### Advanced Content Management
53
+ - **Posts**: Supports both flat files (`.mdx`) and nested folders (`/index.mdx`) with co-located assets.
54
+ - **Flows**: Daily notes or micro-posts organized by date (`YYYY/MM/DD`). Designed for quick thoughts and stream-of-consciousness updates.
55
+ - **Series**:
56
+ - Robust grouping with folder-based or file-based entries.
57
+ - Configurable sorting: `date-asc`, `date-desc`, or `manual` (explicit list of slugs).
58
+ - Cross-referencing: Series can include posts from the general pool or other folders.
59
+ - Metadata inheritance: Posts can inherit attributes (like authors) from series index files.
60
+ - **Featured Content**: Mark posts or series as `featured` to display them in prominent homepage sections with horizontal scrolling.
61
+ - **Cover Images**: Support for local paths, external URLs, and dynamic desaturated gradients (`text:Label`).
62
+ - **External Links**: Posts can include a list of curated external resources in frontmatter.
63
+
64
+ ### Refined UX & Design
65
+ - **Homepage**: Elegant layout with "Curated Series" and "Featured Stories" sections using horizontal scroll triggers.
66
+ - **Navigation**: Command+K fuzzy search, sticky TOC with progress tracking, and Series Catalog sidebars.
67
+ - **Theming**: Four built-in palettes (`default`, `blue`, `rose`, `amber`) with high-contrast Dark Mode support.
68
+ - **i18n**: Multi-language infrastructure (en, zh) with footer language switcher. `site.config.ts` supports localized strings.
69
+
70
+ ### Build Pipeline
71
+ - **Asset Mapping**: `scripts/copy-assets.ts` mirrors content assets to the public folder, handling relative path resolution for both flat and nested structures.
72
+ - **Image Optimization**: Fully integrated with `next-image-export-optimizer` for optimized WebP delivery in static exports.
73
+
74
+ ## Recent Updates
75
+ - Added **Flows** feature: a stream for daily notes and micro-blogging.
76
+ - Upgraded to Next.js 16.1.1 and React 19.
77
+ - Implemented robust series sorting and manual selection logic.
78
+ - Refined homepage layout with horizontal scrolling and distinct card styles for Series, Featured, and Latest sections.
79
+ - Added comprehensive CLI tools for PDF and Image-to-post conversions.
80
+ - Unified simple page layouts (About, Tags, Archive) for visual consistency.
81
+ - Resolved text-rendering cover image display issues using stable utility classes.
82
+ - Added pagination to the main posts list and individual series pages.
83
+ - Implemented sophisticated reading time calculation for mixed Latin and CJK text.
84
+ - Enhanced author management with metadata inheritance and slug-based routing.
package/README.md ADDED
@@ -0,0 +1,172 @@
1
+ # Amytis
2
+
3
+ **Amytis** is a high-performance, elegant digital garden built with Next.js 16, React 19, and Tailwind CSS v4. It is designed for cultivating thoughts, sharing knowledge, and growing ideas with a focus on typography and readability.
4
+
5
+ [**Live Demo**](https://amytis.vercel.app/)
6
+
7
+ ![Amytis Screenshot](public/screenshot.png)
8
+
9
+ ## Features
10
+
11
+ - **Digital Garden Philosophy:** Non-linear navigation through tags, series, authors, books, flows, and chronological archives.
12
+ - **Fuzzy Search:** Instant, client-side search across all posts (Cmd/Ctrl+K) powered by Fuse.js.
13
+ - **Structured Content:**
14
+ - **Series:** Multi-part content organization with manual or automatic ordering.
15
+ - **Books:** Long-form content with explicit chapters, parts, and a dedicated reading interface.
16
+ - **Flows:** Stream-style daily notes or micro-blogging for quick thoughts.
17
+ - **Rich MDX Content:**
18
+ - GitHub Flavored Markdown (tables, task lists, strikethrough).
19
+ - Syntax-highlighted code blocks.
20
+ - Mermaid diagrams (flowcharts, sequence diagrams, etc.).
21
+ - LaTeX math via KaTeX.
22
+ - Raw HTML support for custom layouts.
23
+ - **Elegant Design:**
24
+ - Minimalist aesthetic with high-contrast typography.
25
+ - Light/Dark mode with automatic system detection.
26
+ - Four color palettes: default (emerald), blue, rose, amber.
27
+ - Responsive layout optimized for reading.
28
+ - Horizontal scrolling for featured content on the homepage.
29
+ - **Table of Contents:** Sticky TOC with scroll tracking, reading progress indicator, and active heading highlight.
30
+ - **Flexible Content Structure:**
31
+ - Flat files (`post.mdx`) or nested folders (`post/index.mdx`).
32
+ - Co-located assets: keep images inside post folders (`./images/`).
33
+ - Date-prefixed filenames: `2026-01-01-my-post.mdx`.
34
+ - Draft support for posts, series, books, and flows.
35
+ - **Performance & SEO:**
36
+ - Fully static export with optimized WebP images.
37
+ - Native sitemap and RSS feed generation.
38
+ - Multilingual reading time estimate (supports Latin and CJK).
39
+ - **Integrations:**
40
+ - Analytics: Umami, Plausible, or Google Analytics.
41
+ - Comments: Giscus (GitHub Discussions) or Disqus.
42
+ - Internationalization: multi-language support (en, zh) with localized `site.config.ts`.
43
+ - **Content CLI Tools:** Create posts, series, and import from PDFs or image folders.
44
+ - **Modern Stack:** Next.js 16, React 19, Tailwind CSS v4, TypeScript 5, Bun.
45
+
46
+ ## Quick Start
47
+
48
+ 1. **Install Dependencies:**
49
+ ```bash
50
+ bun install
51
+ ```
52
+
53
+ 2. **Start Development Server:**
54
+ ```bash
55
+ bun dev
56
+ ```
57
+ Visit [http://localhost:3000](http://localhost:3000).
58
+
59
+ 3. **Build for Production (Static Export):**
60
+ ```bash
61
+ bun run build
62
+ ```
63
+ The static site will be generated in the `out/` directory with optimized images.
64
+
65
+ 4. **Development Build (faster, no image optimization):**
66
+ ```bash
67
+ bun run build:dev
68
+ ```
69
+
70
+ ## CLI Commands
71
+
72
+ ```bash
73
+ # Development
74
+ bun dev # Start dev server at localhost:3000
75
+ bun run lint # Run ESLint
76
+
77
+ # Build
78
+ bun run build # Full production build (copy assets + Next.js build + image optimization)
79
+ bun run build:dev # Development build (no image optimization, faster)
80
+ bun run clean # Remove .next, out, public/posts directories
81
+
82
+ # Testing
83
+ bun test # Run all tests
84
+ bun run test:unit # Run unit tests (src/)
85
+ bun run test:int # Run integration tests
86
+ bun run test:e2e # Run end-to-end tests
87
+
88
+ # Content creation
89
+ bun run new "Post Title" # Create new post (flat file)
90
+ bun run new "Title" --folder # Create as folder with index.mdx
91
+ bun run new "Title" --prefix weekly # Create with prefix (e.g., weekly-title)
92
+ bun run new "Title" --template custom # Use custom template from templates/
93
+ bun run new "Title" --md # Create as .md instead of .mdx
94
+ bun run new "Title" --series my-series # Create post in a series directory
95
+ bun run new-series "Series Name" # Create new series with cover image placeholder
96
+ bun run new-from-pdf doc.pdf # Create post from PDF (converts pages to images)
97
+ bun run new-from-pdf doc.pdf --title "My Doc" # With custom title
98
+ bun run new-from-pdf doc.pdf --scale 3.0 # Higher resolution (default: 2.0)
99
+ bun run new-from-images ./photos # Create post from image folder
100
+ bun run new-from-images ./photos --title "Gallery" # With custom title
101
+ bun run new-from-images ./photos --sort date # Sort by date (default: name)
102
+ bun run new-from-images ./photos --no-copy # Reference images instead of copying
103
+ ```
104
+
105
+ ## Configuration
106
+
107
+ All site settings are managed in `site.config.ts`:
108
+
109
+ ```typescript
110
+ export const siteConfig = {
111
+ // ...
112
+ nav: [
113
+ { name: "Home", url: "/", weight: 1 },
114
+ { name: "Flow", url: "/flows", weight: 1.1 }, // Add Flows to nav
115
+ { name: "Series", url: "/series", weight: 1.5 },
116
+ { name: "Books", url: "/books", weight: 1.7 },
117
+ { name: "Archive", url: "/archive", weight: 2 },
118
+ // ...
119
+ ],
120
+ // ...
121
+ flows: {
122
+ recentCount: 5,
123
+ },
124
+ };
125
+ ```
126
+
127
+ ## Writing Content
128
+
129
+ ### Posts
130
+
131
+ Create `.md` or `.mdx` files in `content/posts/`.
132
+
133
+ ### Flows
134
+
135
+ Create daily notes in `content/flows/YYYY/MM/DD.mdx` or `content/flows/YYYY/MM/DD/index.mdx`.
136
+
137
+ ### Series
138
+
139
+ Create a directory in `content/series/` with an `index.mdx`.
140
+
141
+ ### Books
142
+
143
+ Books are for long-form, structured content. Create a directory in `content/books/`.
144
+
145
+ ## Project Structure
146
+
147
+ ```
148
+ amytis/
149
+ content/
150
+ posts/ # Blog posts
151
+ series/ # Series collections
152
+ books/ # Long-form books
153
+ flows/ # Daily notes (YYYY/MM/DD)
154
+ about.mdx # Static pages
155
+ public/ # Static assets
156
+ src/
157
+ app/ # Next.js App Router pages
158
+ books/ # Book routes
159
+ flows/ # Flow routes
160
+ components/ # React components
161
+ lib/
162
+ markdown.ts # Data access layer
163
+ ```
164
+
165
+ ## Documentation
166
+
167
+ - [Architecture Overview](docs/ARCHITECTURE.md)
168
+ - [Contributing Guide](docs/CONTRIBUTING.md)
169
+
170
+ ## License
171
+
172
+ MIT
package/TODO.md ADDED
@@ -0,0 +1,76 @@
1
+ # Future Roadmap
2
+
3
+ ## 🚀 High Priority (Next Steps)
4
+
5
+ - [ ] **User Experience (UX)**
6
+ - [ ] **Code Blocks**: Add a "Copy to Clipboard" button.
7
+ - [ ] **Images**: Implement a Lightbox or Zoom-on-click feature.
8
+ - [ ] **Navigation**: Add Breadcrumbs (e.g., `Home > Category > Post`).
9
+ - [ ] **Navigation**: Add Previous/Next post links at the bottom of articles.
10
+
11
+ ## 🌿 Digital Garden Features
12
+
13
+ - [ ] **Knowledge Graph**:
14
+ - [ ] **Backlinks**: Show "Pages that link here" at the bottom of posts.
15
+ - [ ] **Wiki-links**: Support `[[Internal Link]]` syntax.
16
+
17
+ ## 🔮 Future Enhancements
18
+
19
+ - [ ] **Performance & App**
20
+ - [ ] **PWA**: Add `manifest.json` and service workers for offline support.
21
+ - [ ] **Search Optimization**: Optimize search index for large gardens (e.g. content segmentation).
22
+
23
+ - [ ] **Visuals**
24
+ - [ ] **Dynamic OG Images**: Generate custom social cards with post title using `@vercel/og` (Satori).
25
+
26
+ - [ ] **CLI Enhancements**
27
+ - [ ] **Interactive Mode**: Use prompts to select series, tags, and layouts when creating new posts.
28
+
29
+ ## ✅ Completed
30
+
31
+ - [x] **Content Types**
32
+ - [x] **Flows**: Stream-style daily notes or micro-blogging.
33
+ - [x] **Books**: Structured long-form content with chapters.
34
+
35
+ - [x] **Engagement**
36
+ - [x] **Comments**: Integrate Giscus (GitHub Discussions) for comments.
37
+
38
+ - [x] **Engineering**
39
+ - [x] **Validation**: Add Zod schema validation for content frontmatter to prevent build errors.
40
+ - [x] **Testing**: Add E2E tests for the new search and navigation features.
41
+
42
+ - [x] **SEO & Discovery**
43
+ - [x] Generate `sitemap.xml` for search engines.
44
+ - [x] Generate `rss.xml` / `atom.xml` for feed readers.
45
+ - [x] Add Open Graph (OG) meta tags for social sharing.
46
+
47
+ - [x] **Navigation & UX**
48
+ - [x] Implement a client-side fuzzy Search bar (Command+K).
49
+ - [x] Add a sticky Table of Contents (TOC) with Unicode/Multilingual support.
50
+ - [x] Add "Reading Time" estimate to post headers.
51
+ - [x] Refine link styling (clean default, underline on hover).
52
+ - [x] **Hero Section**: Configurable, collapsible welcome mat.
53
+ - [x] **Themes**: Configurable color palettes (default, blue, rose, amber).
54
+ - [x] **i18n**: Client-side language switcher infrastructure.
55
+
56
+ - [x] **Content & Architecture**
57
+ - [x] **Series**: Robust support for grouping related posts (file-based & folder-based).
58
+ - [x] **Series**: Manual sorting, cross-referencing, and configurable order.
59
+ - [x] **Related Posts**: Auto-suggest relevant articles.
60
+ - [x] **Cover Images**: Support local paths, external URLs, and generated text covers.
61
+ - [x] **Analytics**: Privacy-friendly configuration (Umami/Plausible/Google).
62
+
63
+ - [x] **Performance**
64
+ - [x] Static Image Optimization (`next-image-export-optimizer`).
65
+ - [x] Automated image dimension injection.
66
+
67
+ - [x] **CLI Tools**
68
+ - [x] `bun run new` script for scaffolding posts.
69
+ - [x] `bun run new-series` script for scaffolding series.
70
+
71
+ - [x] **UI Polish & Refinements**
72
+ - [x] **Animations**: Define missing animation classes.
73
+ - [x] **Color Contrast**: Improve accessibility.
74
+ - [x] **Responsive Grids**: Improve mobile/tablet layouts.
75
+ - [x] **Archive Timeline**: Refine CSS.
76
+ - [x] **Loading States**: Add skeleton loaders.