diff --git a/docs/__tests__/meta-validation.test.ts b/docs/__tests__/meta-validation.test.ts new file mode 100644 index 00000000..e1623fb9 --- /dev/null +++ b/docs/__tests__/meta-validation.test.ts @@ -0,0 +1,95 @@ +import { describe, it, expect } from 'vitest' +import { pathToFileURL } from 'url' +import fs from 'fs' +import path from 'path' + +const PAGES_DIR = path.join(__dirname, '..', 'pages') + +function findMetaFiles(dir: string): string[] { + const results: string[] = [] + if (!fs.existsSync(dir)) return results + + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const fullPath = path.join(dir, entry.name) + if (entry.isDirectory()) { + results.push(...findMetaFiles(fullPath)) + } else if (/^_meta\.(js|jsx|ts|tsx)$/.test(entry.name)) { + results.push(fullPath) + } + } + return results +} + +async function loadMeta(metaFile: string): Promise> { + const mod = await import(pathToFileURL(metaFile).href) + return (mod.default ?? mod) as Record +} + +function findMdxFiles(dir: string): string[] { + const results: string[] = [] + if (!fs.existsSync(dir)) return results + + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const fullPath = path.join(dir, entry.name) + if (entry.isDirectory()) { + results.push(...findMdxFiles(fullPath)) + } else if (entry.name.endsWith('.mdx')) { + results.push(fullPath) + } + } + return results +} + +function metaKeyResolvesToFile(pagesDir: string, key: string): boolean { + const mdxFile = path.join(pagesDir, `${key}.mdx`) + const indexFile = path.join(pagesDir, key, 'index.mdx') + const dirPath = path.join(pagesDir, key) + + return ( + fs.existsSync(mdxFile) || + fs.existsSync(indexFile) || + (fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) + ) +} + +function hasTitleFrontmatter(content: string): boolean { + const match = content.match(/^---\s*\n([\s\S]*?)\n---/) + if (!match) return false + return /^title\s*:/m.test(match[1]) +} + +describe('meta validation', () => { + it('all _meta entries resolve to existing files', async () => { + const metaFiles = findMetaFiles(PAGES_DIR) + expect(metaFiles.length).toBeGreaterThan(0) + + for (const metaFile of metaFiles) { + const dir = path.dirname(metaFile) + const meta = await loadMeta(metaFile) + + for (const key of Object.keys(meta)) { + expect( + metaKeyResolvesToFile(dir, key), + `_meta key "${key}" in ${path.relative(PAGES_DIR, metaFile)} does not resolve to a file` + ).toBe(true) + } + } + }) + + it('all MDX files have title frontmatter', () => { + const mdxFiles = findMdxFiles(PAGES_DIR) + + for (const mdxFile of mdxFiles) { + const content = fs.readFileSync(mdxFile, 'utf-8') + expect( + hasTitleFrontmatter(content), + `${path.relative(PAGES_DIR, mdxFile)} is missing title frontmatter` + ).toBe(true) + } + }) + + it('finds at least 10 MDX pages', () => { + const mdxFiles = findMdxFiles(PAGES_DIR) + expect(mdxFiles.length).toBeGreaterThanOrEqual(10) + }) +}) diff --git a/docs/pages/_app.tsx b/docs/pages/_app.tsx new file mode 100644 index 00000000..66c929b8 --- /dev/null +++ b/docs/pages/_app.tsx @@ -0,0 +1,6 @@ +import type { AppProps } from 'next/app' +import 'nextra-theme-docs/style.css' + +export default function App({ Component, pageProps }: AppProps) { + return +} diff --git a/docs/pages/_meta.ts b/docs/pages/_meta.ts new file mode 100644 index 00000000..e78d2df6 --- /dev/null +++ b/docs/pages/_meta.ts @@ -0,0 +1,7 @@ +export default { + index: 'ホーム', + 'getting-started': 'はじめに', + 'self-hosting': 'セルフホスト', + 'api-reference': 'API リファレンス', + contributing: 'コントリビューター', +} diff --git a/docs/pages/api-reference/_meta.ts b/docs/pages/api-reference/_meta.ts new file mode 100644 index 00000000..93925519 --- /dev/null +++ b/docs/pages/api-reference/_meta.ts @@ -0,0 +1,4 @@ +export default { + rest: 'REST API', + graphql: 'GraphQL API', +} diff --git a/docs/pages/api-reference/graphql.mdx b/docs/pages/api-reference/graphql.mdx new file mode 100644 index 00000000..0c0eb529 --- /dev/null +++ b/docs/pages/api-reference/graphql.mdx @@ -0,0 +1,15 @@ +--- +title: GraphQL API +--- + +# GraphQL API + +open-git は GitHub GraphQL API v4 互換のスキーマを部分的に提供します。 + +## エンドポイント + +``` +POST /graphql +``` + +GraphQL スキーマから自動生成されるリファレンスは今後統合予定です。 diff --git a/docs/pages/api-reference/rest.mdx b/docs/pages/api-reference/rest.mdx new file mode 100644 index 00000000..87c376b2 --- /dev/null +++ b/docs/pages/api-reference/rest.mdx @@ -0,0 +1,15 @@ +--- +title: REST API +--- + +# REST API + +open-git は GitHub REST API v3 互換のエンドポイントを提供します。 + +## 認証 + +Personal Access Token または OAuth トークンを使用して API にアクセスします。詳細は今後追加予定です。 + +## エンドポイント一覧 + +OpenAPI 定義から自動生成されるリファレンスは今後統合予定です。 diff --git a/docs/pages/contributing/_meta.ts b/docs/pages/contributing/_meta.ts new file mode 100644 index 00000000..01615284 --- /dev/null +++ b/docs/pages/contributing/_meta.ts @@ -0,0 +1,5 @@ +export default { + index: 'コントリビューターガイド', + license: 'ライセンス', + branding: 'ブランディング', +} diff --git a/docs/pages/contributing/branding.mdx b/docs/pages/contributing/branding.mdx new file mode 100644 index 00000000..28e44f63 --- /dev/null +++ b/docs/pages/contributing/branding.mdx @@ -0,0 +1,11 @@ +--- +title: ブランディング +--- + +# ブランディング + +open-git の商標・ロゴ使用ガイドラインです。 + +## ロゴと商標 + +open-git のロゴおよび商標の使用に関するルールは今後追加予定です。GitHub の商標を侵害する表記・ロゴの使用は禁止されています。 diff --git a/docs/pages/contributing/index.mdx b/docs/pages/contributing/index.mdx new file mode 100644 index 00000000..96bd2281 --- /dev/null +++ b/docs/pages/contributing/index.mdx @@ -0,0 +1,20 @@ +--- +title: コントリビューターガイド +--- + +# コントリビューターガイド + +open-git への貢献にご関心をお寄せいただきありがとうございます。 + +## はじめに + +Issue の報告、Pull Request の提出、ドキュメントの改善など、あらゆる形の貢献を歓迎します。 + +## ライセンス + +本プロジェクトは [LICENSE](/LICENSE) ファイルに記載されたライセンスの下で提供されています。コントリビューションを行う前にライセンス条項をご確認ください。 + +## 関連リンク + +- [ライセンス](/contributing/license) +- [ブランディング](/contributing/branding) diff --git a/docs/pages/contributing/license.mdx b/docs/pages/contributing/license.mdx new file mode 100644 index 00000000..f96f7b1a --- /dev/null +++ b/docs/pages/contributing/license.mdx @@ -0,0 +1,11 @@ +--- +title: ライセンス +--- + +# ライセンス + +open-git のライセンス情報です。 + +## オープンソースライセンス + +本プロジェクトのライセンス条項はリポジトリルートの LICENSE ファイルを参照してください。詳細な説明は今後追加予定です。 diff --git a/docs/pages/getting-started/_meta.ts b/docs/pages/getting-started/_meta.ts new file mode 100644 index 00000000..e60b48e1 --- /dev/null +++ b/docs/pages/getting-started/_meta.ts @@ -0,0 +1,5 @@ +export default { + index: '概要', + installation: 'インストール', + quickstart: 'クイックスタート', +} diff --git a/docs/pages/getting-started/index.mdx b/docs/pages/getting-started/index.mdx new file mode 100644 index 00000000..b972a4e5 --- /dev/null +++ b/docs/pages/getting-started/index.mdx @@ -0,0 +1,12 @@ +--- +title: はじめに +--- + +# はじめに + +open-git へようこそ。このセクションでは、open-git の概要と最初のセットアップ手順を説明します。 + +## このセクションの内容 + +- [インストール](/getting-started/installation) — Docker Compose または Helm を使ったインストール +- [クイックスタート](/getting-started/quickstart) — インストール後の最初の操作 diff --git a/docs/pages/getting-started/installation.mdx b/docs/pages/getting-started/installation.mdx new file mode 100644 index 00000000..282c69cd --- /dev/null +++ b/docs/pages/getting-started/installation.mdx @@ -0,0 +1,26 @@ +--- +title: インストール +order: 1 +--- + +# インストール + +open-git をセルフホスト環境にインストールする方法を説明します。 + +## Docker Compose + +```bash +# TODO: Docker Compose インストール手順 +docker compose up -d +``` + +Docker Compose を使った最も簡単なインストール方法です。詳細な手順は今後追加予定です。 + +## Helm + +```bash +# TODO: Helm インストール手順 +helm install open-git ./charts/open-git +``` + +Kubernetes 環境では Helm チャートを使用してデプロイできます。詳細な手順は今後追加予定です。 diff --git a/docs/pages/getting-started/quickstart.mdx b/docs/pages/getting-started/quickstart.mdx new file mode 100644 index 00000000..54a7785a --- /dev/null +++ b/docs/pages/getting-started/quickstart.mdx @@ -0,0 +1,25 @@ +--- +title: クイックスタート +order: 2 +--- + +# クイックスタート + +インストールが完了したら、以下の手順で open-git を使い始められます。 + +## 1. 管理者アカウントの作成 + +```bash +# TODO: 初期管理者アカウント作成コマンド +``` + +## 2. 最初のリポジトリを作成 + +Web UI または CLI からリポジトリを作成します。詳細な手順は今後追加予定です。 + +## 3. リモートを追加して push + +```bash +git remote add origin https://your-open-git.example.com/user/repo.git +git push -u origin main +``` diff --git a/docs/pages/index.mdx b/docs/pages/index.mdx new file mode 100644 index 00000000..2da27468 --- /dev/null +++ b/docs/pages/index.mdx @@ -0,0 +1,14 @@ +--- +title: ホーム +description: open-git 公式ドキュメント +--- + +# open-git ドキュメント + +open-git は GitHub 互換のセルフホスト型 Git プラットフォームです。このドキュメントでは、インストールから運用、API リファレンスまでを案内します。 + +## 次のステップ + +- [はじめに](/getting-started) — 概要とクイックスタート +- [インストール](/getting-started/installation) — Docker Compose / Helm によるセットアップ +- [クイックスタート](/getting-started/quickstart) — 最初のリポジトリを作成する diff --git a/docs/pages/self-hosting/_meta.ts b/docs/pages/self-hosting/_meta.ts new file mode 100644 index 00000000..ef98073d --- /dev/null +++ b/docs/pages/self-hosting/_meta.ts @@ -0,0 +1,5 @@ +export default { + index: '概要', + traefik: 'Traefik 設定', + database: 'データベース', +} diff --git a/docs/pages/self-hosting/database.mdx b/docs/pages/self-hosting/database.mdx new file mode 100644 index 00000000..d3188087 --- /dev/null +++ b/docs/pages/self-hosting/database.mdx @@ -0,0 +1,15 @@ +--- +title: データベース +--- + +# データベース + +open-git がサポートするデータベースオプションと設定方法を説明します。 + +## PostgreSQL (推奨) + +本番環境では PostgreSQL の使用を推奨します。接続設定の詳細は今後追加予定です。 + +## SQLite + +小規模なデプロイや開発環境では SQLite も利用できます。設定手順は今後追加予定です。 diff --git a/docs/pages/self-hosting/index.mdx b/docs/pages/self-hosting/index.mdx new file mode 100644 index 00000000..ccc2b290 --- /dev/null +++ b/docs/pages/self-hosting/index.mdx @@ -0,0 +1,12 @@ +--- +title: セルフホスト概要 +--- + +# セルフホスト概要 + +open-git を本番環境で運用するための構成ガイドです。 + +## このセクションの内容 + +- [Traefik 設定](/self-hosting/traefik) — リバースプロキシと TLS 終端 +- [データベース](/self-hosting/database) — PostgreSQL / SQLite の選定と設定 diff --git a/docs/pages/self-hosting/traefik.mdx b/docs/pages/self-hosting/traefik.mdx new file mode 100644 index 00000000..0d070656 --- /dev/null +++ b/docs/pages/self-hosting/traefik.mdx @@ -0,0 +1,15 @@ +--- +title: Traefik 設定 +--- + +# Traefik 設定 + +Traefik をリバースプロキシとして使用し、open-git への HTTPS アクセスを構成する方法を説明します。 + +## 基本構成 + +```yaml +# TODO: Traefik ルーター設定例 +``` + +TLS 証明書の自動取得 (Let's Encrypt) やパスベースルーティングの詳細は今後追加予定です。 diff --git a/docs/public/robots.txt b/docs/public/robots.txt new file mode 100644 index 00000000..c2a49f4f --- /dev/null +++ b/docs/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Allow: /