Add coverage prettification and sorting functionality

- Introduced `prettify.css` for syntax highlighting in coverage reports.
- Added `prettify.js` to handle code formatting and highlighting.
- Included `sort-arrow-sprite.png` for sort indicators in the coverage table.
- Implemented `sorter.js` to enable sorting and filtering of coverage summary tables.
- Added a search box for filtering table rows based on user input.
This commit is contained in:
catlog22
2026-02-07 22:21:05 +08:00
parent 6073627ff2
commit ece02ab32a
40 changed files with 2828 additions and 728 deletions

View File

@@ -16,7 +16,7 @@ Unified issue discovery and creation skill covering three entry points: manual i
│ → Action selection → Route to phase → Execute → Summary │
└───────────────┬─────────────────────────────────────────────────┘
├─ AskUserQuestion: Select action
├─ ASK_USER: Select action
┌───────────┼───────────┬───────────┐
↓ ↓ ↓ │
@@ -38,7 +38,7 @@ Unified issue discovery and creation skill covering three entry points: manual i
## Key Design Principles
1. **Action-Driven Routing**: AskUserQuestion selects action, then load single phase
1. **Action-Driven Routing**: ASK_USER selects action, then load single phase
2. **Progressive Phase Loading**: Only read the selected phase document
3. **CLI-First Data Access**: All issue CRUD via `ccw issue` CLI commands
4. **Auto Mode Support**: `-y` flag skips action selection with auto-detection
@@ -89,7 +89,7 @@ Action Selection:
│ ├─ Path pattern (src/**, *.ts) → Discover (Phase 2)
│ ├─ Short text (< 80 chars) → Create New (Phase 1)
│ └─ Long descriptive text (≥ 80 chars) → Discover by Prompt (Phase 3)
└─ Otherwise → AskUserQuestion to select action
└─ Otherwise → ASK_USER to select action
Phase Execution (load one phase):
├─ Phase 1: Create New → phases/01-issue-new.md
@@ -155,31 +155,29 @@ function detectAction(input, flags) {
}
```
### Action Selection (AskUserQuestion)
### Action Selection (ASK_USER)
```javascript
// When action cannot be auto-detected
const answer = AskUserQuestion({
questions: [{
question: "What would you like to do?",
header: "Action",
multiSelect: false,
options: [
{
label: "Create New Issue (Recommended)",
description: "Create issue from GitHub URL, text description, or structured input"
},
{
label: "Discover Issues",
description: "Multi-perspective discovery: bug, security, test, quality, performance, etc."
},
{
label: "Discover by Prompt",
description: "Describe what to find — Gemini plans the exploration strategy iteratively"
}
]
}]
});
const answer = ASK_USER([{
id: "action",
type: "select",
prompt: "What would you like to do?",
options: [
{
label: "Create New Issue (Recommended)",
description: "Create issue from GitHub URL, text description, or structured input"
},
{
label: "Discover Issues",
description: "Multi-perspective discovery: bug, security, test, quality, performance, etc."
},
{
label: "Discover by Prompt",
description: "Describe what to find — Gemini plans the exploration strategy iteratively"
}
]
}]); // BLOCKS (wait for user response)
// Route based on selection
const actionMap = {
@@ -196,7 +194,7 @@ User Input (URL / text / path pattern / descriptive prompt)
[Parse Flags + Auto-Detect Action]
[Action Selection] ← AskUserQuestion (if needed)
[Action Selection] ← ASK_USER (if needed)
[Read Selected Phase Document]
@@ -294,7 +292,7 @@ close_agent({ id: agentId })
| Error | Resolution |
|-------|------------|
| No action detected | Show AskUserQuestion with all 3 options |
| No action detected | Show ASK_USER with all 3 options |
| Invalid action type | Show available actions, re-prompt |
| Phase execution fails | Report error, suggest manual intervention |
| No files matched (discover) | Check target pattern, verify path exists |
@@ -307,33 +305,29 @@ After successful phase execution, recommend next action:
```javascript
// After Create New (issue created)
AskUserQuestion({
questions: [{
question: "Issue created. What next?",
header: "Next",
multiSelect: false,
options: [
{ label: "Plan Solution", description: "Generate solution via issue-resolve" },
{ label: "Create Another", description: "Create more issues" },
{ label: "View Issues", description: "Review all issues" },
{ label: "Done", description: "Exit workflow" }
]
}]
});
ASK_USER([{
id: "next_after_create",
type: "select",
prompt: "Issue created. What next?",
options: [
{ label: "Plan Solution", description: "Generate solution via issue-resolve" },
{ label: "Create Another", description: "Create more issues" },
{ label: "View Issues", description: "Review all issues" },
{ label: "Done", description: "Exit workflow" }
]
}]); // BLOCKS (wait for user response)
// After Discover / Discover by Prompt (discoveries generated)
AskUserQuestion({
questions: [{
question: "Discovery complete. What next?",
header: "Next",
multiSelect: false,
options: [
{ label: "Export to Issues", description: "Convert discoveries to issues" },
{ label: "Plan Solutions", description: "Plan solutions for exported issues via issue-resolve" },
{ label: "Done", description: "Exit workflow" }
]
}]
});
ASK_USER([{
id: "next_after_discover",
type: "select",
prompt: "Discovery complete. What next?",
options: [
{ label: "Export to Issues", description: "Convert discoveries to issues" },
{ label: "Plan Solutions", description: "Plan solutions for exported issues via issue-resolve" },
{ label: "Done", description: "Exit workflow" }
]
}]); // BLOCKS (wait for user response)
```
## Related Skills & Commands

View File

@@ -145,16 +145,12 @@ if (clarityScore >= 1 && clarityScore <= 2 && !issueData.affected_components?.le
```javascript
// ONLY ask questions if clarity is low
if (clarityScore < 2 && (!issueData.context || issueData.context.length < 20)) {
const answer = AskUserQuestion({
questions: [{
question: 'Please describe the issue in more detail:',
header: 'Clarify',
multiSelect: false,
options: [
{ label: 'Provide details', description: 'Describe what, where, and expected behavior' }
]
}]
});
const answer = ASK_USER([{
id: "clarify",
type: "input",
prompt: "Please describe the issue in more detail:",
description: "Describe what, where, and expected behavior"
}]); // BLOCKS (wait for user response)
if (answer.customText) {
issueData.context = answer.customText;
@@ -176,19 +172,9 @@ if (clarityScore < 2 && (!issueData.context || issueData.context.length < 20)) {
let publishToGitHub = false;
if (issueData.source !== 'github') {
const publishAnswer = AskUserQuestion({
questions: [{
question: 'Would you like to publish this issue to GitHub?',
header: 'Publish',
multiSelect: false,
options: [
{ label: 'Yes, publish to GitHub', description: 'Create issue on GitHub and link it' },
{ label: 'No, keep local only', description: 'Store as local issue without GitHub sync' }
]
}]
});
publishToGitHub = publishAnswer.answers?.['Publish']?.includes('Yes');
// Yes → Create issue on GitHub and link it
// No → Store as local issue without GitHub sync
publishToGitHub = CONFIRM("Would you like to publish this issue to GitHub?"); // BLOCKS (wait for user response)
}
```
@@ -242,14 +228,14 @@ Phase 2: Data Extraction (branched by clarity)
│ Score 3 │ Score 1-2 │ Score 0 │
│ GitHub │ Text + ACE │ Vague │
├────────────┼─────────────────┼──────────────┤
│ gh CLI │ Parse struct │ AskQuestion
│ gh CLI │ Parse struct │ ASK_USER
│ → parse │ + quick hint │ (1 question) │
│ │ (3 files max) │ → feedback │
└────────────┴─────────────────┴──────────────┘
Phase 3: GitHub Publishing Decision (non-GitHub only)
├─ Source = github: Skip (already from GitHub)
└─ Source ≠ github: AskUserQuestion
└─ Source ≠ github: CONFIRM
├─ Yes → publishToGitHub = true
└─ No → publishToGitHub = false

View File

@@ -86,20 +86,18 @@ let selectedPerspectives = [];
if (args.perspectives) {
selectedPerspectives = args.perspectives.split(',').map(p => p.trim());
} else {
// Interactive selection via AskUserQuestion
const response = AskUserQuestion({
questions: [{
question: "Select primary discovery focus:",
header: "Focus",
multiSelect: false,
options: [
{ label: "Bug + Test + Quality", description: "Quick scan: potential bugs, test gaps, code quality (Recommended)" },
{ label: "Security + Performance", description: "System audit: security issues, performance bottlenecks" },
{ label: "Maintainability + Best-practices", description: "Long-term health: coupling, tech debt, conventions" },
{ label: "Full analysis", description: "All 8 perspectives (comprehensive, takes longer)" }
]
}]
});
// Interactive selection via ASK_USER
const response = ASK_USER([{
id: "focus",
type: "select",
prompt: "Select primary discovery focus:",
options: [
{ label: "Bug + Test + Quality", description: "Quick scan: potential bugs, test gaps, code quality (Recommended)" },
{ label: "Security + Performance", description: "System audit: security issues, performance bottlenecks" },
{ label: "Maintainability + Best-practices", description: "Long-term health: coupling, tech debt, conventions" },
{ label: "Full analysis", description: "All 8 perspectives (comprehensive, takes longer)" }
]
}]); // BLOCKS (wait for user response)
selectedPerspectives = parseSelectedPerspectives(response);
}
```
@@ -273,22 +271,20 @@ await updateDiscoveryState(outputDir, {
```javascript
const hasHighPriority = issues.some(i => i.priority === 'critical' || i.priority === 'high');
await AskUserQuestion({
questions: [{
question: `Discovery complete: ${issues.length} issues generated, ${prioritizedFindings.length} total findings. What next?`,
header: "Next Step",
multiSelect: false,
options: hasHighPriority ? [
{ label: "Export to Issues (Recommended)", description: `${issues.length} high-priority issues found - export to tracker` },
{ label: "Open Dashboard", description: "Review findings in ccw view before exporting" },
{ label: "Skip", description: "Complete discovery without exporting" }
] : [
{ label: "Open Dashboard (Recommended)", description: "Review findings in ccw view to decide which to export" },
{ label: "Export to Issues", description: `Export ${issues.length} issues to tracker` },
{ label: "Skip", description: "Complete discovery without exporting" }
]
}]
});
await ASK_USER([{
id: "next_step",
type: "select",
prompt: `Discovery complete: ${issues.length} issues generated, ${prioritizedFindings.length} total findings. What next?`,
options: hasHighPriority ? [
{ label: "Export to Issues (Recommended)", description: `${issues.length} high-priority issues found - export to tracker` },
{ label: "Open Dashboard", description: "Review findings in ccw view before exporting" },
{ label: "Skip", description: "Complete discovery without exporting" }
] : [
{ label: "Open Dashboard (Recommended)", description: "Review findings in ccw view to decide which to export" },
{ label: "Export to Issues", description: `Export ${issues.length} issues to tracker` },
{ label: "Skip", description: "Complete discovery without exporting" }
]
}]); // BLOCKS (wait for user response)
if (response === "Export to Issues") {
await appendJsonl('.workflow/issues/issues.jsonl', issues);

View File

@@ -389,19 +389,17 @@ await updateDiscoveryState(outputDir, {
});
// Prompt user for next action
await AskUserQuestion({
questions: [{
question: `Discovery complete: ${issues.length} issues from ${cumulativeFindings.length} findings across ${iteration} iterations. What next?`,
header: "Next Step",
multiSelect: false,
options: [
{ label: "Export to Issues (Recommended)", description: `Export ${issues.length} issues for planning` },
{ label: "Review Details", description: "View comparison analysis and iteration details" },
{ label: "Run Deeper", description: "Continue with more iterations" },
{ label: "Skip", description: "Complete without exporting" }
]
}]
});
await ASK_USER([{
id: "next_step",
type: "select",
prompt: `Discovery complete: ${issues.length} issues from ${cumulativeFindings.length} findings across ${iteration} iterations. What next?`,
options: [
{ label: "Export to Issues (Recommended)", description: `Export ${issues.length} issues for planning` },
{ label: "Review Details", description: "View comparison analysis and iteration details" },
{ label: "Run Deeper", description: "Continue with more iterations" },
{ label: "Skip", description: "Complete without exporting" }
]
}]); // BLOCKS (wait for user response)
```
## Dimension Agent Prompt Template