docs: 更新实施计划文档格式和内容

- 添加Claude本地设置文件,允许Bash操作权限
- 将文档中的分隔线从"---"统一改为"***"
- 修复markdown代码块嵌套格式问题
- 调整任务列表格式,移除多余空行
- 修正HTTP链接的markdown格式
- 更新.gitignore文件格式,修复转义字符问题
This commit is contained in:
panw
2026-03-31 17:26:07 +08:00
parent a7cfa381e7
commit 34944518f0
2 changed files with 96 additions and 70 deletions

View File

@@ -0,0 +1,8 @@
{
"permissions": {
"allow": [
"Bash(mkdir:*)",
"Bash(rm:*)"
]
}
}

View File

@@ -8,19 +8,19 @@
**Tech Stack:** Go 1.26+, Gin, SQLite (mattn/go-sqlite3), Vue 3, Element Plus, Pinia, Vite, golang-jwt/jwt, bcrypt **Tech Stack:** Go 1.26+, Gin, SQLite (mattn/go-sqlite3), Vue 3, Element Plus, Pinia, Vite, golang-jwt/jwt, bcrypt
--- ***
## Phase 1: Project Initialization and Core Infrastructure ## Phase 1: Project Initialization and Core Infrastructure
### Task 1: Initialize Go Module and Project Structure ### Task 1: Initialize Go Module and Project Structure
**Files:** **Files:**
- Create: `go.mod` - Create: `go.mod`
- Create: `go.sum` (auto-generated) - Create: `go.sum` (auto-generated)
- Create: `Makefile` - Create: `Makefile`
- Create: `main.go` - Create: `main.go`
- Create: `README.md` - Create: `README.md`
- [ ] **Step 1: Initialize Go module** - [ ] **Step 1: Initialize Go module**
```bash ```bash
@@ -139,7 +139,7 @@ func runServer() error {
Create `README.md`: Create `README.md`:
```markdown ````markdown
# GitM - Gitea Repository Sync Tool # GitM - Gitea Repository Sync Tool
Cross-platform tool to synchronize all repositories from multiple Gitea servers to local storage. Cross-platform tool to synchronize all repositories from multiple Gitea servers to local storage.
@@ -157,7 +157,7 @@ Cross-platform tool to synchronize all repositories from multiple Gitea servers
```bash ```bash
make all make all
``` ````
## Run ## Run
@@ -184,23 +184,24 @@ cd web && npm run dev
# Run backend (requires frontend built first) # Run backend (requires frontend built first)
go run main.go go run main.go
``` ```
```
````
- [ ] **Step 7: Commit** - [ ] **Step 7: Commit**
```bash ```bash
git add go.mod go.sum Makefile main.go README.md git add go.mod go.sum Makefile main.go README.md
git commit -m "feat: initialize project structure and dependencies" git commit -m "feat: initialize project structure and dependencies"
``` ````
--- ***
### Task 2: Create Internal Package Structure ### Task 2: Create Internal Package Structure
**Files:** **Files:**
- Create: `internal/config/config.go` - Create: `internal/config/config.go`
- Create: `internal/models/models.go` - Create: `internal/models/models.go`
- [ ] **Step 1: Create config package** - [ ] **Step 1: Create config package**
Create `internal/config/config.go`: Create `internal/config/config.go`:
@@ -319,13 +320,13 @@ git add internal/config/config.go internal/models/models.go
git commit -m "feat: add config and models packages" git commit -m "feat: add config and models packages"
``` ```
--- ***
### Task 3: Implement Database Layer ### Task 3: Implement Database Layer
**Files:** **Files:**
- Create: `internal/database/database.go`
- Create: `internal/database/database.go`
- [ ] **Step 1: Create database package** - [ ] **Step 1: Create database package**
Create `internal/database/database.go`: Create `internal/database/database.go`:
@@ -655,14 +656,14 @@ git add internal/database/
git commit -m "feat: implement SQLite database layer" git commit -m "feat: implement SQLite database layer"
``` ```
--- ***
### Task 4: Implement JWT Authentication ### Task 4: Implement JWT Authentication
**Files:** **Files:**
- Create: `internal/middleware/auth.go` - Create: `internal/middleware/auth.go`
- Create: `internal/handler/auth.go` - Create: `internal/handler/auth.go`
- [ ] **Step 1: Create auth middleware** - [ ] **Step 1: Create auth middleware**
Create `internal/middleware/auth.go`: Create `internal/middleware/auth.go`:
@@ -961,16 +962,16 @@ git add internal/middleware/ internal/handler/
git commit -m "feat: implement JWT authentication middleware and handlers" git commit -m "feat: implement JWT authentication middleware and handlers"
``` ```
--- ***
## Phase 2: Gitea API Integration ## Phase 2: Gitea API Integration
### Task 5: Implement Gitea API Client ### Task 5: Implement Gitea API Client
**Files:** **Files:**
- Create: `internal/gitea/client.go` - Create: `internal/gitea/client.go`
- Create: `internal/gitea/types.go` - Create: `internal/gitea/types.go`
- [ ] **Step 1: Create Gitea types** - [ ] **Step 1: Create Gitea types**
Create `internal/gitea/types.go`: Create `internal/gitea/types.go`:
@@ -1145,14 +1146,14 @@ git add internal/gitea/
git commit -m "feat: implement Gitea API client" git commit -m "feat: implement Gitea API client"
``` ```
--- ***
### Task 6: Implement Sync Engine ### Task 6: Implement Sync Engine
**Files:** **Files:**
- Create: `internal/sync/engine.go` - Create: `internal/sync/engine.go`
- Create: `internal/sync/scheduler.go` - Create: `internal/sync/scheduler.go`
- [ ] **Step 1: Create sync engine** - [ ] **Step 1: Create sync engine**
Create `internal/sync/engine.go`: Create `internal/sync/engine.go`:
@@ -1532,15 +1533,15 @@ git add internal/sync/
git commit -m "feat: implement sync engine and scheduler" git commit -m "feat: implement sync engine and scheduler"
``` ```
--- ***
## Phase 3: HTTP Handlers ## Phase 3: HTTP Handlers
### Task 7: Implement Server Management Handlers ### Task 7: Implement Server Management Handlers
**Files:** **Files:**
- Create: `internal/handler/server.go`
- Create: `internal/handler/server.go`
- [ ] **Step 1: Create server handler** - [ ] **Step 1: Create server handler**
Create `internal/handler/server.go`: Create `internal/handler/server.go`:
@@ -1885,13 +1886,13 @@ git add internal/handler/server.go
git commit -m "feat: implement server management handlers" git commit -m "feat: implement server management handlers"
``` ```
--- ***
### Task 8: Implement Log and Stats Handlers ### Task 8: Implement Log and Stats Handlers
**Files:** **Files:**
- Create: `internal/handler/log.go`
- Create: `internal/handler/log.go`
- [ ] **Step 1: Create log handler** - [ ] **Step 1: Create log handler**
Create `internal/handler/log.go`: Create `internal/handler/log.go`:
@@ -1991,13 +1992,13 @@ git add internal/handler/log.go
git commit -m "feat: implement sync log and stats handlers" git commit -m "feat: implement sync log and stats handlers"
``` ```
--- ***
### Task 9: Wire Up Main Server ### Task 9: Wire Up Main Server
**Files:** **Files:**
- Modify: `main.go`
- Modify: `main.go`
- [ ] **Step 1: Update main.go with full server implementation** - [ ] **Step 1: Update main.go with full server implementation**
Replace `main.go` with: Replace `main.go` with:
@@ -2204,20 +2205,20 @@ git add main.go
git commit -m "feat: wire up main server with all routes" git commit -m "feat: wire up main server with all routes"
``` ```
--- ***
## Phase 4: Frontend Implementation ## Phase 4: Frontend Implementation
### Task 10: Initialize Vue 3 Frontend ### Task 10: Initialize Vue 3 Frontend
**Files:** **Files:**
- Create: `web/package.json` - Create: `web/package.json`
- Create: `web/vite.config.ts` - Create: `web/vite.config.ts`
- Create: `web/tsconfig.json` - Create: `web/tsconfig.json`
- Create: `web/index.html` - Create: `web/index.html`
- Create: `web/src/main.ts` - Create: `web/src/main.ts`
- Create: `web/src/App.vue` - Create: `web/src/App.vue`
- [ ] **Step 1: Create web/package.json** - [ ] **Step 1: Create web/package.json**
Create `web/package.json`: Create `web/package.json`:
@@ -2478,15 +2479,15 @@ git add web/
git commit -m "feat: initialize Vue 3 frontend structure" git commit -m "feat: initialize Vue 3 frontend structure"
``` ```
--- ***
### Task 11: Create API Client and Auth Store ### Task 11: Create API Client and Auth Store
**Files:** **Files:**
- Create: `web/src/api/index.ts` - Create: `web/src/api/index.ts`
- Create: `web/src/api/types.ts` - Create: `web/src/api/types.ts`
- Create: `web/src/stores/auth.ts` - Create: `web/src/stores/auth.ts`
- [ ] **Step 1: Create API types** - [ ] **Step 1: Create API types**
Create `web/src/api/types.ts`: Create `web/src/api/types.ts`:
@@ -2687,13 +2688,13 @@ git add web/src/api/ web/src/stores/
git commit -m "feat: add API client and auth store" git commit -m "feat: add API client and auth store"
``` ```
--- ***
### Task 12: Create Login Page ### Task 12: Create Login Page
**Files:** **Files:**
- Create: `web/src/views/Login.vue`
- Create: `web/src/views/Login.vue`
- [ ] **Step 1: Create Login.vue** - [ ] **Step 1: Create Login.vue**
Create `web/src/views/Login.vue`: Create `web/src/views/Login.vue`:
@@ -2814,13 +2815,13 @@ git add web/src/views/Login.vue
git commit -m "feat: add login page" git commit -m "feat: add login page"
``` ```
--- ***
### Task 13: Create Layout Component ### Task 13: Create Layout Component
**Files:** **Files:**
- Create: `web/src/views/Layout.vue`
- Create: `web/src/views/Layout.vue`
- [ ] **Step 1: Create Layout.vue** - [ ] **Step 1: Create Layout.vue**
Create `web/src/views/Layout.vue`: Create `web/src/views/Layout.vue`:
@@ -2962,13 +2963,13 @@ git add web/src/views/Layout.vue
git commit -m "feat: add layout component with navigation" git commit -m "feat: add layout component with navigation"
``` ```
--- ***
### Task 14: Create Dashboard Page ### Task 14: Create Dashboard Page
**Files:** **Files:**
- Create: `web/src/views/Dashboard.vue`
- Create: `web/src/views/Dashboard.vue`
- [ ] **Step 1: Create Dashboard.vue** - [ ] **Step 1: Create Dashboard.vue**
Create `web/src/views/Dashboard.vue`: Create `web/src/views/Dashboard.vue`:
@@ -3162,13 +3163,13 @@ git add web/src/views/Dashboard.vue
git commit -m "feat: add dashboard page" git commit -m "feat: add dashboard page"
``` ```
--- ***
### Task 15: Create Servers Page ### Task 15: Create Servers Page
**Files:** **Files:**
- Create: `web/src/views/Servers.vue`
- Create: `web/src/views/Servers.vue`
- [ ] **Step 1: Create Servers.vue** - [ ] **Step 1: Create Servers.vue**
Create `web/src/views/Servers.vue`: Create `web/src/views/Servers.vue`:
@@ -3433,15 +3434,15 @@ git add web/src/views/Servers.vue
git commit -m "feat: add servers management page" git commit -m "feat: add servers management page"
``` ```
--- ***
### Task 16: Create Repositories, Logs, and Settings Pages ### Task 16: Create Repositories, Logs, and Settings Pages
**Files:** **Files:**
- Create: `web/src/views/Repos.vue` - Create: `web/src/views/Repos.vue`
- Create: `web/src/views/Logs.vue` - Create: `web/src/views/Logs.vue`
- Create: `web/src/views/Settings.vue` - Create: `web/src/views/Settings.vue`
- [ ] **Step 1: Create Repos.vue** - [ ] **Step 1: Create Repos.vue**
Create `web/src/views/Repos.vue`: Create `web/src/views/Repos.vue`:
@@ -3847,16 +3848,16 @@ git add web/src/views/Repos.vue web/src/views/Logs.vue web/src/views/Settings.vu
git commit -m "feat: add repos, logs, and settings pages" git commit -m "feat: add repos, logs, and settings pages"
``` ```
--- ***
## Phase 5: Frontend Build Integration ## Phase 5: Frontend Build Integration
### Task 17: Embed Frontend in Go Binary ### Task 17: Embed Frontend in Go Binary
**Files:** **Files:**
- Modify: `main.go` - Modify: `main.go`
- Modify: `Makefile` - Modify: `Makefile`
- [ ] **Step 1: Add embed directive to main.go** - [ ] **Step 1: Add embed directive to main.go**
Edit `main.go`, add after the imports: Edit `main.go`, add after the imports:
@@ -3904,7 +3905,7 @@ Edit `main.go`, update the `runServer` function. Find the comment about static f
}) })
``` ```
- [ ] **Step 3: Add `"net/http"` to imports** - [ ] **Step 3: Add** **`"net/http"`** **to imports**
Edit `main.go` imports: Edit `main.go` imports:
@@ -4055,16 +4056,16 @@ git add main.go Makefile
git commit -m "feat: embed frontend in Go binary" git commit -m "feat: embed frontend in Go binary"
``` ```
--- ***
## Phase 6: Testing and Documentation ## Phase 6: Testing and Documentation
### Task 18: Create Tests ### Task 18: Create Tests
**Files:** **Files:**
- Create: `internal/database/database_test.go` - Create: `internal/database/database_test.go`
- Create: `internal/gitea/client_test.go` - Create: `internal/gitea/client_test.go`
- [ ] **Step 1: Create database tests** - [ ] **Step 1: Create database tests**
Create `internal/database/database_test.go`: Create `internal/database/database_test.go`:
@@ -4205,19 +4206,19 @@ git add internal/database/database_test.go internal/gitea/client_test.go
git commit -m "test: add unit tests for database and Gitea client" git commit -m "test: add unit tests for database and Gitea client"
``` ```
--- ***
### Task 19: Final Documentation ### Task 19: Final Documentation
**Files:** **Files:**
- Modify: `README.md` - Modify: `README.md`
- Create: `.gitignore` - Create: `.gitignore`
- [ ] **Step 1: Update README.md** - [ ] **Step 1: Update README.md**
Replace `README.md` with: Replace `README.md` with:
```markdown ````markdown
# GitM - Gitea Repository Sync Tool # GitM - Gitea Repository Sync Tool
Cross-platform tool to synchronize all repositories from multiple Gitea servers to local storage. Cross-platform tool to synchronize all repositories from multiple Gitea servers to local storage.
@@ -4246,7 +4247,7 @@ cd gitm
make all make all
# The binary will be at bin/gitm # The binary will be at bin/gitm
``` ````
### First Run ### First Run
@@ -4264,8 +4265,9 @@ make all
### Access Web UI ### Access Web UI
Open your browser and navigate to: Open your browser and navigate to:
- http://localhost:9000 (default)
- http://localhost:9090 (if you used --addr :9090) - <http://localhost:9000> (default)
- <http://localhost:9090> (if you used --addr :9090)
## Usage ## Usage
@@ -4302,6 +4304,7 @@ To discover new repositories without syncing, click **Discover**.
### Storage ### Storage
Repositories are stored as bare git mirrors at: Repositories are stored as bare git mirrors at:
``` ```
<data_dir>/repos/server_<id>_<name>/<owner>/<repo>.git <data_dir>/repos/server_<id>_<name>/<owner>/<repo>.git
``` ```
@@ -4322,14 +4325,17 @@ Settings are stored in the SQLite database and can be changed via the Web UI:
The API is available at `/api/` and requires JWT authentication: The API is available at `/api/` and requires JWT authentication:
### Authentication ### Authentication
- `POST /api/login` - Authenticate and get token - `POST /api/login` - Authenticate and get token
- `POST /api/init` - Initialize admin password - `POST /api/init` - Initialize admin password
### Settings ### Settings
- `GET /api/settings` - Get all settings - `GET /api/settings` - Get all settings
- `PUT /api/settings` - Update settings - `PUT /api/settings` - Update settings
### Servers ### Servers
- `GET /api/servers` - List all servers - `GET /api/servers` - List all servers
- `POST /api/servers` - Add a server - `POST /api/servers` - Add a server
- `PUT /api/servers/:id` - Update a server - `PUT /api/servers/:id` - Update a server
@@ -4341,6 +4347,7 @@ The API is available at `/api/` and requires JWT authentication:
- `GET /api/servers/:id/sync/status` - Get sync status - `GET /api/servers/:id/sync/status` - Get sync status
### Sync ### Sync
- `POST /api/sync/all` - Sync all servers - `POST /api/sync/all` - Sync all servers
- `GET /api/sync/logs` - Get sync logs - `GET /api/sync/logs` - Get sync logs
- `GET /api/sync/stats` - Get statistics - `GET /api/sync/stats` - Get statistics
@@ -4361,7 +4368,7 @@ npm install
npm run dev npm run dev
``` ```
The dev server runs on http://localhost:5173 with API proxy to :9000. The dev server runs on <http://localhost:5173> with API proxy to :9000.
### Backend Development ### Backend Development
@@ -4409,6 +4416,7 @@ gitm/
## License ## License
MIT License MIT License
``` ```
- [ ] **Step 2: Create .gitignore** - [ ] **Step 2: Create .gitignore**
@@ -4416,62 +4424,71 @@ MIT License
Create `.gitignore`: Create `.gitignore`:
``` ```
# Binaries # Binaries
bin/ bin/
gitm gitm
gitm.exe gitm.exe
gitm-linux gitm-linux
# Data # Data
data/ data/
*.db \*.db
*.db-shm \*.db-shm
*.db-wal \*.db-wal
# Go # Go
*.exe
*.exe~ \*.exe
*.dll \*.exe\~
*.so \*.dll
*.dylib \*.so
*.test \*.dylib
*.out \*.test
\*.out
go.work go.work
# Node # Node
web/node_modules/
web/node\_modules/
web/dist/ web/dist/
# IDE # IDE
.idea/ .idea/
.vscode/ .vscode/
*.swp \*.swp
*.swo \*.swo
*~ \*\~
# OS # OS
.DS_Store
.DS\_Store
Thumbs.db Thumbs.db
# Temporary # Temporary
*.log
*.tmp \*.log
``` \*.tmp
````
- [ ] **Step 3: Commit** - [ ] **Step 3: Commit**
```bash ```bash
git add README.md .gitignore git add README.md .gitignore
git commit -m "docs: update README and add .gitignore" git commit -m "docs: update README and add .gitignore"
``` ````
--- ***
## Task 20: Final Build Verification ## Task 20: Final Build Verification
**Files:** **Files:**
- None (verification task)
- None (verification task)
- [ ] **Step 1: Full clean build** - [ ] **Step 1: Full clean build**
```bash ```bash
@@ -4537,7 +4554,7 @@ git add -A
git commit -m "chore: final build verification complete" git commit -m "chore: final build verification complete"
``` ```
--- ***
## Implementation Complete ## Implementation Complete
@@ -4566,3 +4583,4 @@ The GitM project is now fully implemented with:
6. Add more detailed sync progress reporting 6. Add more detailed sync progress reporting
7. Implement backup/restore functionality 7. Implement backup/restore functionality
8. Add Docker support 8. Add Docker support