Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

Commit 880376a

Browse files
catlog22claude
andcommitted
feat: 优化 Solution ID 命名机制并添加 GitHub 链接显示
- Solution ID 改用 4 位随机 uid (如 SOL-GH-123-a7x9) 避免多次规划时覆盖 - issue 卡片添加 GitHub 链接图标,支持点击跳转到对应 issue Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a20f81d commit 880376a

4 files changed

Lines changed: 22 additions & 9 deletions

File tree

.claude/agents/issue-plan-agent.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,14 @@ Write solution JSON to JSONL file (one line per solution):
212212
213213
**File Format** (JSONL - each line is a complete solution):
214214
```
215-
{"id":"SOL-GH-123-1","description":"...","approach":"...","analysis":{...},"score":0.85,"tasks":[...]}
216-
{"id":"SOL-GH-123-2","description":"...","approach":"...","analysis":{...},"score":0.75,"tasks":[...]}
215+
{"id":"SOL-GH-123-a7x9","description":"...","approach":"...","analysis":{...},"score":0.85,"tasks":[...]}
216+
{"id":"SOL-GH-123-b2k4","description":"...","approach":"...","analysis":{...},"score":0.75,"tasks":[...]}
217217
```
218218
219219
**Solution Schema** (must match CLI `Solution` interface):
220220
```typescript
221221
{
222-
id: string; // Format: SOL-{issue-id}-{N}
222+
id: string; // Format: SOL-{issue-id}-{uid}
223223
description?: string;
224224
approach?: string;
225225
tasks: SolutionTask[];
@@ -232,9 +232,14 @@ Write solution JSON to JSONL file (one line per solution):
232232
**Write Operation**:
233233
```javascript
234234
// Append solution to JSONL file (one line per solution)
235-
const solutionId = `SOL-${issueId}-${seq}`;
235+
// Use 4-char random uid to avoid collisions across multiple plan runs
236+
const uid = Math.random().toString(36).slice(2, 6); // e.g., "a7x9"
237+
const solutionId = `SOL-${issueId}-${uid}`;
236238
const solutionLine = JSON.stringify({ id: solutionId, ...solution });
237239

240+
// Bash equivalent for uid generation:
241+
// uid=$(cat /dev/urandom | tr -dc 'a-z0-9' | head -c 4)
242+
238243
// Read existing, append new line, write back
239244
const filePath = `.workflow/issues/solutions/${issueId}.jsonl`;
240245
const existing = existsSync(filePath) ? readFileSync(filePath) : '';
@@ -311,7 +316,7 @@ Each line is a solution JSON containing tasks. Schema: `cat .claude/workflows/cl
311316
6. Evaluate each solution with `analysis` and `score`
312317
7. Write solutions to `.workflow/issues/solutions/{issue-id}.jsonl` (append mode)
313318
8. For HIGH complexity: generate 2-3 candidate solutions
314-
9. **Solution ID format**: `SOL-{issue-id}-{N}` (e.g., `SOL-GH-123-1`, `SOL-GH-123-2`)
319+
9. **Solution ID format**: `SOL-{issue-id}-{uid}` where uid is 4 random alphanumeric chars (e.g., `SOL-GH-123-a7x9`)
315320
10. **GitHub Reply Task**: If issue has `github_url` or `github_number`, add final task to comment on GitHub issue with completion summary
316321
317322
**CONFLICT AVOIDANCE** (for batch processing of similar issues):

.claude/commands/issue/plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ ${issueList}
203203
7. Single solution → auto-bind; Multiple → return for selection
204204
205205
### Rules
206-
- Solution ID format: SOL-{issue-id}-{seq}
206+
- Solution ID format: SOL-{issue-id}-{uid} (uid: 4 random alphanumeric chars, e.g., a7x9)
207207
- Single solution per issue → auto-bind via ccw issue bind
208208
- Multiple solutions → register only, return pending_selection
209209
- Tasks must have quantified acceptance.criteria

.claude/workflows/cli-templates/schemas/solution-schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"properties": {
88
"id": {
99
"type": "string",
10-
"description": "Unique solution identifier: SOL-{issue-id}-{seq}",
11-
"pattern": "^SOL-.+-[0-9]+$",
12-
"examples": ["SOL-GH-123-1", "SOL-ISS-20251229-1"]
10+
"description": "Unique solution identifier: SOL-{issue-id}-{4-char-uid} where uid is 4 alphanumeric chars",
11+
"pattern": "^SOL-.+-[a-z0-9]{4}$",
12+
"examples": ["SOL-GH-123-a7x9", "SOL-ISS-20251229-001-b2k4"]
1313
},
1414
"description": {
1515
"type": "string",

ccw/src/templates/dashboard-js/views/issue-manager.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,14 @@ function renderIssueCard(issue) {
338338
${t('issues.boundSolution') || 'Bound'}
339339
</span>
340340
` : ''}
341+
${issue.github_url ? `
342+
<a href="${issue.github_url}" target="_blank" rel="noopener noreferrer"
343+
class="flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors"
344+
onclick="event.stopPropagation()" title="View on GitHub">
345+
<i data-lucide="github" class="w-3.5 h-3.5"></i>
346+
${issue.github_number ? `#${issue.github_number}` : 'GitHub'}
347+
</a>
348+
` : ''}
341349
</div>
342350
</div>
343351
`;

0 commit comments

Comments
 (0)