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
---
***
## Phase 1: Project Initialization and Core Infrastructure
### Task 1: Initialize Go Module and Project Structure
**Files:**
- Create: `go.mod`
- Create: `go.sum` (auto-generated)
- Create: `Makefile`
- Create: `main.go`
- Create: `README.md`
- [ ] **Step 1: Initialize Go module**
```bash
@@ -139,7 +139,7 @@ func runServer() error {
Create `README.md`:
```markdown
````markdown
# GitM - Gitea Repository Sync Tool
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
make all
```
````
## Run
@@ -184,23 +184,24 @@ cd web && npm run dev
# Run backend (requires frontend built first)
go run main.go
```
```
````
- [ ] **Step 7: Commit**
```bash
git add go.mod go.sum Makefile main.go README.md
git commit -m "feat: initialize project structure and dependencies"
```
````
---
***
### Task 2: Create Internal Package Structure
**Files:**
- Create: `internal/config/config.go`
- Create: `internal/models/models.go`
- [ ] **Step 1: Create config package**
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"
```
---
***
### Task 3: Implement Database Layer
**Files:**
- Create: `internal/database/database.go`
- Create: `internal/database/database.go`
- [ ] **Step 1: Create database package**
Create `internal/database/database.go`:
@@ -655,14 +656,14 @@ git add internal/database/
git commit -m "feat: implement SQLite database layer"
```
---
***
### Task 4: Implement JWT Authentication
**Files:**
- Create: `internal/middleware/auth.go`
- Create: `internal/handler/auth.go`
- [ ] **Step 1: Create auth middleware**
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"
```
---
***
## Phase 2: Gitea API Integration
### Task 5: Implement Gitea API Client
**Files:**
- Create: `internal/gitea/client.go`
- Create: `internal/gitea/types.go`
- [ ] **Step 1: Create Gitea types**
Create `internal/gitea/types.go`:
@@ -1145,14 +1146,14 @@ git add internal/gitea/
git commit -m "feat: implement Gitea API client"
```
---
***
### Task 6: Implement Sync Engine
**Files:**
- Create: `internal/sync/engine.go`
- Create: `internal/sync/scheduler.go`
- [ ] **Step 1: Create sync engine**
Create `internal/sync/engine.go`:
@@ -1532,15 +1533,15 @@ git add internal/sync/
git commit -m "feat: implement sync engine and scheduler"
```
---
***
## Phase 3: HTTP Handlers
### Task 7: Implement Server Management Handlers
**Files:**
- Create: `internal/handler/server.go`
- Create: `internal/handler/server.go`
- [ ] **Step 1: Create server handler**
Create `internal/handler/server.go`:
@@ -1885,13 +1886,13 @@ git add internal/handler/server.go
git commit -m "feat: implement server management handlers"
```
---
***
### Task 8: Implement Log and Stats Handlers
**Files:**
- Create: `internal/handler/log.go`
- Create: `internal/handler/log.go`
- [ ] **Step 1: Create log handler**
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"
```
---
***
### Task 9: Wire Up Main Server
**Files:**
- Modify: `main.go`
- Modify: `main.go`
- [ ] **Step 1: Update main.go with full server implementation**
Replace `main.go` with:
@@ -2204,20 +2205,20 @@ git add main.go
git commit -m "feat: wire up main server with all routes"
```
---
***
## Phase 4: Frontend Implementation
### Task 10: Initialize Vue 3 Frontend
**Files:**
- Create: `web/package.json`
- Create: `web/vite.config.ts`
- Create: `web/tsconfig.json`
- Create: `web/index.html`
- Create: `web/src/main.ts`
- Create: `web/src/App.vue`
- [ ] **Step 1: Create web/package.json**
Create `web/package.json`:
@@ -2478,15 +2479,15 @@ git add web/
git commit -m "feat: initialize Vue 3 frontend structure"
```
---
***
### Task 11: Create API Client and Auth Store
**Files:**
- Create: `web/src/api/index.ts`
- Create: `web/src/api/types.ts`
- Create: `web/src/stores/auth.ts`
- [ ] **Step 1: Create API types**
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"
```
---
***
### Task 12: Create Login Page
**Files:**
- Create: `web/src/views/Login.vue`
- Create: `web/src/views/Login.vue`
- [ ] **Step 1: Create 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"
```
---
***
### Task 13: Create Layout Component
**Files:**
- Create: `web/src/views/Layout.vue`
- Create: `web/src/views/Layout.vue`
- [ ] **Step 1: Create 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"
```
---
***
### Task 14: Create Dashboard Page
**Files:**
- Create: `web/src/views/Dashboard.vue`
- Create: `web/src/views/Dashboard.vue`
- [ ] **Step 1: Create 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"
```
---
***
### Task 15: Create Servers Page
**Files:**
- Create: `web/src/views/Servers.vue`
- Create: `web/src/views/Servers.vue`
- [ ] **Step 1: Create 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"
```
---
***
### Task 16: Create Repositories, Logs, and Settings Pages
**Files:**
- Create: `web/src/views/Repos.vue`
- Create: `web/src/views/Logs.vue`
- Create: `web/src/views/Settings.vue`
- [ ] **Step 1: Create 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"
```
---
***
## Phase 5: Frontend Build Integration
### Task 17: Embed Frontend in Go Binary
**Files:**
- Modify: `main.go`
- Modify: `Makefile`
- [ ] **Step 1: Add embed directive to main.go**
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:
@@ -4055,16 +4056,16 @@ git add main.go Makefile
git commit -m "feat: embed frontend in Go binary"
```
---
***
## Phase 6: Testing and Documentation
### Task 18: Create Tests
**Files:**
- Create: `internal/database/database_test.go`
- Create: `internal/gitea/client_test.go`
- [ ] **Step 1: Create database tests**
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"
```
---
***
### Task 19: Final Documentation
**Files:**
- Modify: `README.md`
- Create: `.gitignore`
- [ ] **Step 1: Update README.md**
Replace `README.md` with:
```markdown
````markdown
# GitM - Gitea Repository Sync Tool
Cross-platform tool to synchronize all repositories from multiple Gitea servers to local storage.
@@ -4246,7 +4247,7 @@ cd gitm
make all
# The binary will be at bin/gitm
```
````
### First Run
@@ -4264,8 +4265,9 @@ make all
### Access Web UI
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
@@ -4302,6 +4304,7 @@ To discover new repositories without syncing, click **Discover**.
### Storage
Repositories are stored as bare git mirrors at:
```
<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:
### Authentication
- `POST /api/login` - Authenticate and get token
- `POST /api/init` - Initialize admin password
### Settings
- `GET /api/settings` - Get all settings
- `PUT /api/settings` - Update settings
### Servers
- `GET /api/servers` - List all servers
- `POST /api/servers` - Add 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
### Sync
- `POST /api/sync/all` - Sync all servers
- `GET /api/sync/logs` - Get sync logs
- `GET /api/sync/stats` - Get statistics
@@ -4361,7 +4368,7 @@ npm install
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
@@ -4409,6 +4416,7 @@ gitm/
## License
MIT License
```
- [ ] **Step 2: Create .gitignore**
@@ -4416,62 +4424,71 @@ MIT License
Create `.gitignore`:
```
# Binaries
bin/
gitm
gitm.exe
gitm-linux
# Data
data/
*.db
*.db-shm
*.db-wal
\*.db
\*.db-shm
\*.db-wal
# Go
*.exe
*.exe~
*.dll
*.so
*.dylib
*.test
*.out
\*.exe
\*.exe\~
\*.dll
\*.so
\*.dylib
\*.test
\*.out
go.work
# Node
web/node_modules/
web/node\_modules/
web/dist/
# IDE
.idea/
.vscode/
*.swp
*.swo
*~
\*.swp
\*.swo
\*\~
# OS
.DS_Store
.DS\_Store
Thumbs.db
# Temporary
*.log
*.tmp
```
\*.log
\*.tmp
````
- [ ] **Step 3: Commit**
```bash
git add README.md .gitignore
git commit -m "docs: update README and add .gitignore"
```
````
---
***
## Task 20: Final Build Verification
**Files:**
- None (verification task)
- None (verification task)
- [ ] **Step 1: Full clean build**
```bash
@@ -4537,7 +4554,7 @@ git add -A
git commit -m "chore: final build verification complete"
```
---
***
## Implementation Complete
@@ -4566,3 +4583,4 @@ The GitM project is now fully implemented with:
6. Add more detailed sync progress reporting
7. Implement backup/restore functionality
8. Add Docker support