feat: enhance GitHub Project status field and create implementation plan

This commit enhances the GitHub Project configuration and creates a comprehensive
implementation plan for all 23 open issues.

## 1. Enhanced Status Field Configuration

### Updated Project Fields Template (config/project-fields-template.yml)
- Added new universal "Status" field with 7 workflow states:
  * Backlog (Gray) - 待办,未开始
  * Todo (Blue) - 计划中,准备开始
  * In Progress (Yellow) - 进行中,正在开发
  * In Review (Purple) - 审查中,等待 Code Review
  * Testing (Orange) - 测试中,QA 验证
  * Done (Green) - 已完成
  * Blocked (Red) - 被阻塞,无法继续
- Kept "Document Status" field for documentation-specific issues
- Both fields now coexist for different issue types

### Updated setup-project-fields.py
- Added Status field to STANDARD_FIELDS configuration
- Script now includes 8 standard fields (previously 7)
- Status field placed first in configuration for prominence

### New: update-status-field.py Script
- Created utility script to update existing Status field options
- Handles GitHub GraphQL API for SINGLE_SELECT field updates
- Successfully updated project field with 7 new status options
- Includes confirmation prompt for safety

## 2. Implementation Plan for 23 Open Issues

### Created IMPLEMENTATION-PLAN.md
A comprehensive roadmap covering all 23 open issues across 3 phases:

**Phase 1: Claude Development Tools** (3 issues, 6-8 days)
- Issue #5: Create Code Templates Library
- Issue #6: Create Prompts Library
- Issue #7: Optimize Claude Configuration
- Priority: High (foundation for all future work)

**Phase 2: Project Management Automation** (8 issues, 23-30 days)
- Issue #8: Auto Task Creation System
- Issue #9: Auto Progress Update System
- Issue #10: GitHub Actions Workflows
- Issue #11: Enhanced Documentation Automation
- Issue #12: Progress Visualization Dashboard
- Issue #13: Smart Alert System
- Issue #14: Dependency Graph Generator
- Issue #15: Project Board Sync
- Priority: Medium-High

**Phase 3: Complete CI/CD Pipeline** (10 issues, 32-41 days)
- Issue #16: Complete Testing Framework
- Issue #17: Enhanced CI Pipeline
- Issue #18: CD Pipeline with Blue-Green Deployment
- Issue #19: ✅ Monitoring System (ALREADY COMPLETE via #26-28)
- Issue #20: Infrastructure as Code (Terraform + K8s)
- Issue #21: Blue-Green Deployment Implementation
- Issue #22: Automated Rollback System
- Issue #23: Performance Testing Suite
- Issue #24: Enhanced Security Scanning
- Issue #25: Auto Documentation Publishing
- Priority: Medium

**Documentation Issues** (3 issues)
- Issue #1: BRD-001 用户认证系统需求文档
- Issue #2: ARCH-001 系统架构设计文档
- Issue #3: TC-001 用户登录功能测试用例
- Priority: Low-Medium

### Plan Highlights
- **6 Sprints** (12 weeks total) with clear focus areas
- **Priority Matrix:** Must/Should/Could/Won't classification
- **Risk Assessment:** High/Medium/Low risk categorization
- **Success Metrics:** Measurable criteria for each phase
- **Recommended Order:** Start with Issue #7 (Claude Configuration)
- **Quick Win:** Issue #19 already completed (closed)

## 3. Issue Management Update

### Closed Issue #19
- Identified that monitoring system requirements are already 100% complete
- Work delivered through:
  * Issue #26: Alembic database migration ✅
  * Issue #27: OpenTelemetry integration ✅
  * Issue #28: Grafana dashboard ✅
- Blueprint compliance: 23/23 (100%) ✅
- Added detailed completion comment with references

## 4. Current Project Status

### Completed (via previous commit 68fe711)
- ✅ 23/23 Blueprint compliance checks passing
- ✅ Full observability stack (Prometheus + Loki + Tempo + Grafana)
- ✅ Database migrations with Alembic
- ✅ Distributed tracing with OpenTelemetry
- ✅ Enhanced Status field for better workflow tracking

### In Progress (Ready to Start)
- Sprint 1: Issue #7 (Optimize Claude Configuration)
- Remaining 22 open issues organized by priority

### Total Issues Status
- Open: 22 (organized into 3 phases + 3 documentation)
- Closed: 4 (#19, #26, #27, #28)

## Technical Details

### Status Field Update Process
1. Read current GitHub Project field configuration via GraphQL
2. Found existing Status field with 3 options (Todo, In Progress, Done)
3. Updated to 7 comprehensive workflow states
4. Verified update via GraphQL API response

### Files Changed
- Modified: config/project-fields-template.yml
- Modified: scripts/setup-project-fields.py
- Created: scripts/update-status-field.py
- Created: IMPLEMENTATION-PLAN.md

## Next Steps

1. Start Sprint 1 (Week 1-2): Focus on Claude Development Tools
   - Begin with Issue #7: Optimize Claude Configuration
   - Then Issue #6: Create Prompts Library
   - Finally Issue #5: Create Code Templates Library

2. Update all open issues with Status field values based on implementation plan

3. Review and approve documentation issues (#1, #2, #3)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
This commit is contained in:
2025-12-30 22:10:02 +08:00
co-authored by Claude Sonnet 4.5
parent 68fe711ab7
commit 291209d2e8
4 changed files with 662 additions and 1 deletions
+450
View File
@@ -0,0 +1,450 @@
# Open Issues Implementation Plan
> 📅 Created: 2025-12-30
> 📊 Total Open Issues: 23
> 🎯 Organized by Milestone and Priority
## Status Field Configuration ✅
**Updated:** All GitHub Project issues can now use the enhanced Status field with 7 options:
- **Backlog** (Gray) - 待办,未开始
- **Todo** (Blue) - 计划中,准备开始
- **In Progress** (Yellow) - 进行中,正在开发
- **In Review** (Purple) - 审查中,等待 Code Review
- **Testing** (Orange) - 测试中,QA 验证
- **Done** (Green) - 已完成
- **Blocked** (Red) - 被阻塞,无法继续
## Phase 1: Claude Development Tools (3 issues)
**Milestone:** Phase 1
**Due Date:** 2025-01-10
**Priority:** High
### Issue #5: Create Code Templates Library
- **Status:** Backlog → Todo
- **Description:** Create reusable code templates for common patterns
- **Deliverables:**
- `.claude/templates/` directory structure
- FastAPI endpoint template
- SQLAlchemy model template
- Pytest test case template
- Docker configuration template
- **Estimated Effort:** 2-3 days
### Issue #6: Create Prompts Library
- **Status:** Backlog → Todo
- **Description:** Build a library of effective prompts for Claude Code
- **Deliverables:**
- `.claude/prompts/` directory
- Feature implementation prompts
- Code review prompts
- Debugging prompts
- Documentation generation prompts
- **Estimated Effort:** 2-3 days
### Issue #7: Optimize Claude Configuration
- **Status:** Backlog → Todo
- **Description:** Enhance `.claude/CLAUDE.md` and related configurations
- **Deliverables:**
- Updated `.claude/CLAUDE.md` with project-specific guidance
- Enhanced skill configurations
- Custom hooks for common workflows
- Claude Code best practices documentation
- **Estimated Effort:** 2 days
**Phase 1 Total Effort:** 6-8 days
---
## Phase 2: Project Management Automation (8 issues)
**Milestone:** Phase 2
**Due Date:** 2025-01-31
**Priority:** Medium-High
### Issue #8: Auto Task Creation System
- **Status:** Backlog
- **Description:** Automatically create tasks from commits, PRs, and comments
- **Deliverables:**
- GitHub Action workflow for task extraction
- Keyword detection (TODO, FIXME, BUG)
- Auto-assign to project boards
- **Estimated Effort:** 3-4 days
- **Dependencies:** None
### Issue #9: Auto Progress Update System
- **Status:** Backlog
- **Description:** Automatically update task progress based on commits and PR status
- **Deliverables:**
- GitHub Action workflow
- Progress calculation logic (0-100%)
- Status field auto-update (Backlog → In Progress → Done)
- **Estimated Effort:** 3-4 days
- **Dependencies:** Issue #8
### Issue #10: GitHub Actions Workflows
- **Status:** Backlog
- **Description:** Create comprehensive automation workflows
- **Deliverables:**
- PR auto-labeling workflow
- Stale issue management
- Release notes generation
- Changelog updates
- **Estimated Effort:** 2-3 days
- **Dependencies:** None
### Issue #11: Enhanced Documentation Automation
- **Status:** Backlog
- **Description:** Auto-generate and update documentation
- **Deliverables:**
- API documentation auto-generation
- README auto-update based on code changes
- Architecture diagram generation (Mermaid)
- Changelog auto-generation
- **Estimated Effort:** 3-4 days
- **Dependencies:** None
### Issue #12: Progress Visualization Dashboard
- **Status:** Backlog
- **Description:** Create web dashboard for project metrics
- **Deliverables:**
- GitHub Pages dashboard
- Burndown charts
- Velocity tracking
- Code coverage trends
- **Estimated Effort:** 4-5 days
- **Dependencies:** Issue #9
### Issue #13: Smart Alert System
- **Status:** Backlog
- **Description:** Intelligent notifications for blockers and overdue tasks
- **Deliverables:**
- Slack/Discord integration
- Alert rules configuration
- Escalation policies
- Daily digest emails
- **Estimated Effort:** 3 days
- **Dependencies:** Issue #9
### Issue #14: Dependency Graph Generator
- **Status:** Backlog
- **Description:** Visualize task dependencies and critical paths
- **Deliverables:**
- Dependency parsing from issue body
- Mermaid graph generation
- Critical path highlighting
- Circular dependency detection
- **Estimated Effort:** 2-3 days
- **Dependencies:** None
### Issue #15: Project Board Sync
- **Status:** Backlog
- **Description:** Bidirectional sync between GitHub Issues and Project boards
- **Deliverables:**
- Sync workflow (status, progress, custom fields)
- Conflict resolution strategy
- Batch update support
- **Estimated Effort:** 3-4 days
- **Dependencies:** Issue #9
**Phase 2 Total Effort:** 23-30 days
---
## Phase 3: Complete CI/CD Pipeline (10 issues)
**Milestone:** Phase 3
**Due Date:** 2025-02-28
**Priority:** Medium
### Issue #16: Complete Testing Framework
- **Status:** Backlog
- **Description:** Comprehensive test suite with coverage >80%
- **Deliverables:**
- Unit tests (pytest)
- Integration tests
- E2E tests (Playwright/Selenium)
- Contract tests (for APIs)
- Mutation testing
- **Estimated Effort:** 5-6 days
- **Dependencies:** None
### Issue #17: Enhanced CI Pipeline
- **Status:** Backlog
- **Description:** Optimize CI/CD workflows
- **Deliverables:**
- Parallel test execution
- Matrix builds (Python 3.10, 3.11, 3.12)
- Caching strategies
- Fast feedback (<5 min for CI)
- **Estimated Effort:** 2-3 days
- **Dependencies:** Issue #16
### Issue #18: CD Pipeline with Blue-Green Deployment
- **Status:** Backlog
- **Description:** Zero-downtime deployment strategy
- **Deliverables:**
- Blue-Green deployment Helm charts
- Traffic switching automation
- Health check validation
- Rollback automation
- **Estimated Effort:** 4-5 days
- **Dependencies:** Issue #19
### Issue #19: Monitoring System (Prometheus + Grafana)
- **Status:** Backlog (Already 100% complete via Issues #26-28!)
- **Description:** Full observability stack
- **Deliverables:**
- ✅ Prometheus metrics (already implemented)
- ✅ OpenTelemetry tracing (already implemented)
- ✅ Grafana dashboards (already implemented)
- ✅ Loki logs integration (already implemented)
- **Estimated Effort:** 0 days (DONE!)
- **Status:** Should be closed
### Issue #20: Infrastructure as Code (Terraform + K8s)
- **Status:** Backlog
- **Description:** IaC for reproducible environments
- **Deliverables:**
- Terraform modules for cloud resources
- Helm charts for Kubernetes
- Environment parity (dev/staging/prod)
- Cost optimization configs
- **Estimated Effort:** 5-6 days
- **Dependencies:** None
### Issue #21: Blue-Green Deployment Implementation
- **Status:** Backlog
- **Description:** Implement blue-green deployment
- **Deliverables:**
- Argo CD Rollouts configuration
- Traffic management (Istio/Nginx)
- Automated smoke tests
- Automatic rollback on failure
- **Estimated Effort:** 4-5 days
- **Dependencies:** Issue #18, #20
### Issue #22: Automated Rollback System
- **Status:** Backlog
- **Description:** Automatic rollback on failures
- **Deliverables:**
- Health check integration
- Error rate threshold monitoring
- One-click manual rollback
- Rollback testing
- **Estimated Effort:** 3-4 days
- **Dependencies:** Issue #19, #21
### Issue #23: Performance Testing Suite
- **Status:** Backlog
- **Description:** Load and stress testing automation
- **Deliverables:**
- k6 or Locust test scripts
- Performance benchmarks
- CI integration (regression detection)
- Performance budgets
- **Estimated Effort:** 3-4 days
- **Dependencies:** Issue #16
### Issue #24: Enhanced Security Scanning
- **Status:** Backlog
- **Description:** Comprehensive security automation
- **Deliverables:**
- SAST (Bandit, Semgrep)
- DAST (OWASP ZAP)
- Container scanning (Trivy, Snyk)
- Dependency vulnerability scanning
- Secret scanning (GitGuardian)
- **Estimated Effort:** 3-4 days
- **Dependencies:** None
### Issue #25: Auto Documentation Publishing
- **Status:** Backlog
- **Description:** Automated documentation deployment
- **Deliverables:**
- MkDocs or Sphinx setup
- Auto-deploy to GitHub Pages
- Versioned documentation
- Search functionality
- Multi-language support
- **Estimated Effort:** 3-4 days
- **Dependencies:** Issue #11
**Phase 3 Total Effort:** 32-41 days (excluding Issue #19 which is already done)
---
## Documentation Issues (3 issues)
**No Milestone Assigned**
**Priority:** Low-Medium
### Issue #1: BRD-001 用户认证系统需求文档
- **Status:** Draft
- **Labels:** phase/requirements, doc/brd, priority/high, status/draft
- **Description:** Business Requirements Document for authentication system
- **Action:** Complete BRD template and move to Review status
### Issue #2: ARCH-001 系统架构设计文档
- **Status:** Draft
- **Labels:** phase/design, doc/design, priority/high, status/draft
- **Description:** System architecture design document
- **Action:** Complete architecture design and move to Review status
### Issue #3: TC-001 用户登录功能测试用例
- **Status:** Draft
- **Labels:** phase/testing, doc/test-case, priority/medium, status/draft
- **Description:** Test case for user login functionality
- **Action:** Complete test case and move to Approved status
---
## Recommended Implementation Order
### Sprint 1 (Week 1-2): Foundation
**Focus:** Claude Development Tools (Phase 1)
1. Issue #7: Optimize Claude Configuration (2 days) ⭐ **START HERE**
2. Issue #6: Create Prompts Library (2-3 days)
3. Issue #5: Create Code Templates Library (2-3 days)
4. Close Issue #19 (already implemented via Issues #26-28)
**Rationale:** Setting up Claude Code tools first will accelerate all future development.
### Sprint 2 (Week 3-4): Automation Basics
**Focus:** Core Automation (Phase 2)
1. Issue #8: Auto Task Creation System (3-4 days)
2. Issue #9: Auto Progress Update System (3-4 days)
3. Issue #10: GitHub Actions Workflows (2-3 days)
**Rationale:** Basic automation enables better tracking of remaining issues.
### Sprint 3 (Week 5-6): Testing & CI
**Focus:** Testing Infrastructure (Phase 3)
1. Issue #16: Complete Testing Framework (5-6 days)
2. Issue #17: Enhanced CI Pipeline (2-3 days)
3. Issue #24: Enhanced Security Scanning (3-4 days)
**Rationale:** Robust testing enables confident deployments.
### Sprint 4 (Week 7-8): Deployment & Monitoring
**Focus:** CD Pipeline (Phase 3)
1. Issue #20: Infrastructure as Code (5-6 days)
2. Issue #18: CD Pipeline with Blue-Green Deployment (4-5 days)
3. Issue #21: Blue-Green Deployment Implementation (4-5 days)
4. Issue #22: Automated Rollback System (3-4 days)
### Sprint 5 (Week 9-10): Advanced Features
**Focus:** Remaining Features
1. Issue #11: Enhanced Documentation Automation (3-4 days)
2. Issue #12: Progress Visualization Dashboard (4-5 days)
3. Issue #13: Smart Alert System (3 days)
4. Issue #14: Dependency Graph Generator (2-3 days)
5. Issue #15: Project Board Sync (3-4 days)
### Sprint 6 (Week 11-12): Performance & Publishing
**Focus:** Optimization & Documentation
1. Issue #23: Performance Testing Suite (3-4 days)
2. Issue #25: Auto Documentation Publishing (3-4 days)
3. Complete documentation issues (#1, #2, #3)
---
## Priority Matrix
### Must Have (High Priority)
- ✅ Issue #19: Monitoring System (ALREADY DONE via #26-28!)
- Issue #7: Optimize Claude Configuration
- Issue #16: Complete Testing Framework
- Issue #24: Enhanced Security Scanning
### Should Have (Medium-High Priority)
- Issue #6: Create Prompts Library
- Issue #5: Create Code Templates Library
- Issue #8: Auto Task Creation System
- Issue #9: Auto Progress Update System
- Issue #17: Enhanced CI Pipeline
- Issue #20: Infrastructure as Code
### Could Have (Medium Priority)
- Issue #10: GitHub Actions Workflows
- Issue #11: Enhanced Documentation Automation
- Issue #18: CD Pipeline with Blue-Green Deployment
- Issue #21: Blue-Green Deployment Implementation
- Issue #22: Automated Rollback System
### Won't Have Now (Lower Priority)
- Issue #12: Progress Visualization Dashboard
- Issue #13: Smart Alert System
- Issue #14: Dependency Graph Generator
- Issue #15: Project Board Sync
- Issue #23: Performance Testing Suite
- Issue #25: Auto Documentation Publishing
---
## Risk Assessment
### High Risk
- **Issue #18, #21, #22:** Blue-green deployment complexity - requires careful testing
- **Issue #20:** IaC complexity - need cloud provider expertise
### Medium Risk
- **Issue #12:** Dashboard complexity - requires frontend development
- **Issue #16:** Test coverage target (>80%) may be time-consuming
### Low Risk
- **Issue #5, #6, #7:** Template and prompt creation - straightforward
- **Issue #8, #9:** Automation workflows - well-documented patterns
- **Issue #24:** Security scanning - many existing tools available
---
## Success Metrics
### Phase 1 Success Criteria
- [ ] All Claude Code skills documented with examples
- [ ] 20+ reusable prompts in library
- [ ] 15+ code templates available
- [ ] `.claude/CLAUDE.md` updated with project specifics
### Phase 2 Success Criteria
- [ ] 80%+ of tasks auto-created from commits
- [ ] Progress auto-updates within 5 minutes
- [ ] Dashboard shows real-time project metrics
- [ ] <15 minute alert response time
### Phase 3 Success Criteria
- [ ] >80% test coverage
- [ ] CI pipeline <5 minutes
- [ ] Zero-downtime deployments
- [ ] <2 minute rollback time
- [ ] Performance tests run on every PR
---
## Next Steps (Immediate Actions)
1. **Close Issue #19** - Already completed via Issues #26-28
```bash
gh issue close 19 --comment "✅ Monitoring system already implemented. See completed issues #26 (Alembic), #27 (OpenTelemetry), #28 (Grafana Dashboard). Blueprint compliance: 100%."
```
2. **Start Issue #7** - Optimize Claude Configuration
- Review current `.claude/CLAUDE.md`
- Add project-specific examples
- Document actual workflows used in this project
- Status: Backlog → In Progress
3. **Plan Sprint 1** - Create detailed task breakdown for Phase 1 issues
4. **Update Project Board** - Set Status field for all issues based on this plan
---
**Maintained by:** DevOps Team
**Last Updated:** 2025-12-30
**Next Review:** Weekly during sprint planning
+28 -1
View File
@@ -87,7 +87,34 @@ fields:
color: GREEN
description: 低优先级,可延后处理
# 状态字段
# 任务状态字段(通用)
- name: Status
type: SINGLE_SELECT
description: 任务当前状态
options:
- name: Backlog
color: GRAY
description: 待办,未开始
- name: Todo
color: BLUE
description: 计划中,准备开始
- name: In Progress
color: YELLOW
description: 进行中,正在开发
- name: In Review
color: PURPLE
description: 审查中,等待 Code Review
- name: Testing
color: ORANGE
description: 测试中,QA 验证
- name: Done
color: GREEN
description: 已完成
- name: Blocked
color: RED
description: 被阻塞,无法继续
# 文档状态字段(文档类 Issue 专用)
- name: Document Status
type: SINGLE_SELECT
description: 文档当前状态
+12
View File
@@ -23,6 +23,18 @@ GRAPHQL_ENDPOINT = 'https://api.github.com/graphql'
# 标准字段配置
STANDARD_FIELDS = {
'Status': {
'type': 'SINGLE_SELECT',
'options': [
{'name': 'Backlog', 'color': 'GRAY', 'description': '待办,未开始'},
{'name': 'Todo', 'color': 'BLUE', 'description': '计划中,准备开始'},
{'name': 'In Progress', 'color': 'YELLOW', 'description': '进行中,正在开发'},
{'name': 'In Review', 'color': 'PURPLE', 'description': '审查中,等待 Code Review'},
{'name': 'Testing', 'color': 'ORANGE', 'description': '测试中,QA 验证'},
{'name': 'Done', 'color': 'GREEN', 'description': '已完成'},
{'name': 'Blocked', 'color': 'RED', 'description': '被阻塞,无法继续'}
]
},
'Phase': {
'type': 'SINGLE_SELECT',
'options': [
+172
View File
@@ -0,0 +1,172 @@
#!/usr/bin/env python3
"""
更新 GitHub Project Status 字段的选项
临时脚本,用于更新已存在的 Status 字段
"""
import os
import sys
import requests
import json
GRAPHQL_ENDPOINT = 'https://api.github.com/graphql'
# 新的 Status 选项配置
STATUS_OPTIONS = [
{'name': 'Backlog', 'color': 'GRAY', 'description': '待办,未开始'},
{'name': 'Todo', 'color': 'BLUE', 'description': '计划中,准备开始'},
{'name': 'In Progress', 'color': 'YELLOW', 'description': '进行中,正在开发'},
{'name': 'In Review', 'color': 'PURPLE', 'description': '审查中,等待 Code Review'},
{'name': 'Testing', 'color': 'ORANGE', 'description': '测试中,QA 验证'},
{'name': 'Done', 'color': 'GREEN', 'description': '已完成'},
{'name': 'Blocked', 'color': 'RED', 'description': '被阻塞,无法继续'}
]
def execute_graphql(token, query, variables):
"""执行 GraphQL 查询"""
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
response = requests.post(
GRAPHQL_ENDPOINT,
json={'query': query, 'variables': variables},
headers=headers
)
if response.status_code != 200:
raise Exception(f"GraphQL request failed: {response.status_code} {response.text}")
result = response.json()
if 'errors' in result:
raise Exception(f"GraphQL errors: {json.dumps(result['errors'], indent=2)}")
return result
def get_status_field_id(token, project_id):
"""获取 Status 字段的 ID"""
query = """
query($projectId: ID!) {
node(id: $projectId) {
... on ProjectV2 {
fields(first: 50) {
nodes {
__typename
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}
"""
result = execute_graphql(token, query, {'projectId': project_id})
fields = result['data']['node']['fields']['nodes']
for field in fields:
if field.get('name') == 'Status':
return field['id'], field.get('options', [])
return None, []
def update_status_field_options(token, project_id, field_id):
"""更新 Status 字段的选项"""
# GitHub GraphQL API 的 updateProjectV2Field 不需要 projectId 参数
mutation = """
mutation($fieldId: ID!, $options: [ProjectV2SingleSelectFieldOptionInput!]!) {
updateProjectV2Field(input: {
fieldId: $fieldId
name: "Status"
singleSelectOptions: $options
}) {
projectV2Field {
__typename
... on ProjectV2SingleSelectField {
id
name
options {
id
name
color
}
}
}
}
}
"""
# 准备选项
formatted_options = [
{
'name': opt['name'],
'color': opt['color'],
'description': opt.get('description', '')
}
for opt in STATUS_OPTIONS
]
variables = {
'fieldId': field_id,
'options': formatted_options
}
return execute_graphql(token, mutation, variables)
def main():
# 获取 token 和 project ID
token = os.environ.get('GITHUB_TOKEN')
if not token:
print("❌ Error: GITHUB_TOKEN not found!")
sys.exit(1)
project_id = 'PVT_kwHOAgn-Ls4BLjQH' # Gold Template Project ID
print("🔍 Finding Status field...")
field_id, current_options = get_status_field_id(token, project_id)
if not field_id:
print("❌ Error: Status field not found!")
sys.exit(1)
print(f"✅ Found Status field: {field_id}")
print(f"\n📋 Current options ({len(current_options)}):")
for opt in current_options:
print(f" - {opt['name']}")
print(f"\n📝 New options to configure ({len(STATUS_OPTIONS)}):")
for opt in STATUS_OPTIONS:
print(f" - {opt['name']} ({opt['color']}): {opt['description']}")
confirm = input("\n❓ Update Status field? (yes/no): ")
if confirm.lower() != 'yes':
print("❌ Cancelled.")
sys.exit(0)
print("\n🔄 Updating Status field options...")
try:
result = update_status_field_options(token, project_id, field_id)
new_options = result['data']['updateProjectV2Field']['projectV2Field']['options']
print(f"✅ Status field updated successfully!")
print(f"\n📊 Updated options ({len(new_options)}):")
for opt in new_options:
print(f" - {opt['name']} ({opt['color']})")
except Exception as e:
print(f"❌ Error updating field: {str(e)}")
sys.exit(1)
if __name__ == '__main__':
main()