Skip to content

Commit c55cc19

Browse files
authored
Merge branch 'main' into add-nested-import-test-case
2 parents 0b77d7b + d190563 commit c55cc19

7 files changed

Lines changed: 969 additions & 0 deletions

File tree

.github/workflows/daily-repo-goals.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ If you found a strong candidate, create a pull request that adds a new workflow
175175
- **Generalization plan**: How it would be adapted (what to remove, what to generalize)
176176
- **Proposed name**: A clear name for the generalized workflow
177177

178+
The adapted workflow should retain the core value of the original while being applicable to a wide range of repositories. The documentation should clearly explain the workflow's purpose, how it works, and how to use it.
179+
180+
Do not include any "## Generalization Notes" or "## Adaptation Notes" sections in the docs page, do not include a link back to the original gh-aw workflow in the docs. You can include a link to the blog entry if you think it adds value, but it's not essential.
181+
178182
If no good candidate was found this run, that is fine. Use the `noop` safe output to explain what you checked and why nothing was suitable.
179183

180184
### Step 5: Update memory

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ You can use the "/plan" agent to turn the reports into actionable issues which c
4949

5050
- [📖 Regular Documentation Update](docs/update-docs.md) - Update documentation automatically
5151
- [📖 Daily Documentation Updater](docs/daily-doc-updater.md) - Automatically update documentation based on recent code changes and merged PRs
52+
- [📖 Glossary Maintainer](docs/glossary-maintainer.md) - Automatically maintain project glossary based on codebase changes
5253
- [🔗 Link Checker](docs/link-checker.md) - Daily automated link checker that finds and fixes broken links in documentation
5354
- [✨ Code Simplifier](docs/code-simplifier.md) - Automatically simplify recently modified code for improved clarity and maintainability
55+
- [🔍 Duplicate Code Detector](docs/duplicate-code-detector.md) - Identify duplicate code patterns and suggest refactoring opportunities
5456
- [⚡ Daily Progress](docs/daily-progress.md) - Automated daily feature development following a structured roadmap
5557
- [🧪 Daily Test Coverage Improver](docs/daily-test-improver.md) - Improve test coverage by adding meaningful tests to under-tested areas
5658
- [⚡ Daily Performance Improver](docs/daily-perf-improver.md) - Analyze and improve code performance through benchmarking and optimization

docs/duplicate-code-detector.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# 🔍 Duplicate Code Detector
2+
3+
The **Duplicate Code Detector** workflow automatically identifies duplicate code patterns across your codebase and suggests refactoring opportunities to improve maintainability.
4+
5+
## What It Does
6+
7+
This workflow runs daily to analyze recent code changes and detect duplicate patterns:
8+
9+
- **Analyzes Recent Changes**: Focuses on files modified in recent commits to catch new duplication early
10+
- **Semantic Analysis**: Uses intelligent pattern matching to find duplicates beyond simple text matching
11+
- **Creates Actionable Issues**: Generates focused issues (max 3 per run) for significant duplication patterns
12+
- **Assigns to Copilot**: Issues are automatically assigned to @copilot for potential automated remediation
13+
14+
## Why It's Valuable
15+
16+
Code duplication is a common source of technical debt that:
17+
18+
- Makes maintenance harder (fixes must be applied in multiple places)
19+
- Increases bug risk (inconsistent fixes across duplicated code)
20+
- Bloats the codebase unnecessarily
21+
- Reduces code clarity and understandability
22+
23+
The Duplicate Code Detector helps by:
24+
25+
- **Catching duplication early** before it spreads
26+
- **Providing specific recommendations** for refactoring
27+
- **Enabling automated remediation** through Copilot assignment
28+
- **Improving code quality** continuously over time
29+
30+
## How It Works
31+
32+
1. **Daily Schedule**: Runs automatically every day
33+
2. **Change Analysis**: Examines files modified in recent commits
34+
3. **Pattern Detection**: Searches for:
35+
- Identical or nearly identical functions
36+
- Repeated logic blocks
37+
- Similar implementations of the same functionality
38+
- Copy-pasted code with minor variations
39+
4. **Reporting**: Creates separate issues for each significant pattern found (threshold: >10 lines or 3+ instances)
40+
5. **Assignment**: Issues are assigned to @copilot for automated or manual remediation
41+
42+
## What Gets Detected
43+
44+
### Reported Patterns
45+
46+
- Identical or nearly identical functions in different files
47+
- Repeated code blocks that could be extracted to utilities
48+
- Similar classes or modules with overlapping functionality
49+
- Copy-pasted code with minor modifications
50+
- Duplicated business logic across components
51+
52+
### Excluded Patterns
53+
54+
- Standard boilerplate code (imports, package declarations)
55+
- Test setup/teardown code (acceptable duplication in tests)
56+
- Configuration files with similar structure
57+
- Language-specific patterns (constructors, getters/setters)
58+
- Small code snippets (<5 lines) unless highly repetitive
59+
60+
## Example Output
61+
62+
When duplication is detected, the workflow creates issues like:
63+
64+
````markdown
65+
# 🔍 Duplicate Code Detected: Error Handling Pattern in Parser Module
66+
67+
**Severity**: High
68+
**Occurrences**: 4 instances
69+
**Locations**:
70+
- `src/parser/json.ts` (lines 45-58)
71+
- `src/parser/xml.ts` (lines 67-80)
72+
- `src/parser/yaml.ts` (lines 34-47)
73+
- `src/parser/csv.ts` (lines 89-102)
74+
75+
## Refactoring Recommendations
76+
77+
1. **Extract Common Error Handler**
78+
- Create utility: `src/parser/error-handler.ts`
79+
- Estimated effort: 2-3 hours
80+
- Benefits: Single source of truth, easier to maintain
81+
````
82+
83+
## Merge Rate
84+
85+
Based on usage in the gh-aw repository, this workflow has demonstrated **79% merge rate** (76 merged PRs out of 96 proposed), indicating high practical value and acceptance by maintainers.
86+
87+
## Configuration
88+
89+
The workflow is configured to:
90+
91+
- Run daily on a schedule
92+
- Create max 3 issues per run to avoid overwhelm
93+
- Auto-expire issues after 2 days if not addressed
94+
- Skip test files, generated code, and workflow files
95+
- Focus on source code files only
96+
97+
## Getting Started
98+
99+
This workflow requires no additional setup - it works out of the box with any repository. Simply enable it and it will start analyzing your codebase for duplication patterns.
100+
101+
The workflow uses standard code exploration tools and git commands, making it applicable to any programming language and project structure.
102+
103+
## Learn More
104+
105+
- [GitHub Agentic Workflows Documentation](https://github.github.io/gh-aw/)
106+
- [Blog: Continuous Simplicity Workflows](https://github.github.io/gh-aw/blog/2026-01-13-meet-the-workflows-continuous-simplicity/)

docs/glossary-maintainer.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# 📖 Glossary Maintainer
2+
3+
> For an overview of all available workflows, see the [main README](../README.md).
4+
5+
The [Glossary Maintainer workflow](../workflows/glossary-maintainer.md?plain=1) automatically maintains project glossary or terminology documentation by scanning code changes and keeping technical terms up-to-date.
6+
7+
## Installation
8+
9+
```bash
10+
# Install the 'gh aw' extension
11+
gh extension install github/gh-aw
12+
13+
# Add the workflow to your repository
14+
gh aw add-wizard githubnext/agentics/glossary-maintainer
15+
```
16+
17+
This walks you through adding the workflow to your repository.
18+
19+
You can start a run of this workflow immediately by running:
20+
21+
```bash
22+
gh aw run glossary-maintainer
23+
```
24+
25+
## What It Does
26+
27+
The Glossary Maintainer workflow runs daily on weekdays and:
28+
29+
1. **Scans Recent Changes** - Reviews commits and PRs from the last 24 hours (daily) or 7 days (weekly on Mondays)
30+
2. **Identifies New Terms** - Finds technical terminology, configuration options, and project-specific concepts
31+
3. **Updates Definitions** - Adds new terms or updates existing definitions based on code changes
32+
4. **Maintains Consistency** - Ensures glossary follows existing structure and style
33+
5. **Creates Pull Requests** - Proposes glossary updates for review when new terms are found
34+
35+
## How It Works
36+
37+
### Incremental vs Full Scans
38+
39+
- **Daily (Mon-Fri)**: Incremental scan of last 24 hours
40+
- **Monday**: Full scan of last 7 days for comprehensive review
41+
42+
### What Gets Added
43+
44+
The workflow identifies terms that are:
45+
- Used in user-facing documentation or code
46+
- Project-specific or domain-specific
47+
- Technical terms requiring explanation
48+
- Newly introduced in recent changes
49+
50+
### What Gets Skipped
51+
52+
The workflow avoids adding:
53+
- Generic programming terms
54+
- Self-evident terminology
55+
- Internal implementation details
56+
- Terms only in code comments
57+
58+
## Configuration
59+
60+
This workflow works out of the box and automatically:
61+
- Locates your glossary file (common paths: `docs/glossary.md`, `docs/reference/glossary.md`, `GLOSSARY.md`)
62+
- Follows your existing glossary structure and style
63+
- Maintains alphabetical or categorical organization
64+
- Uses cache memory to avoid duplicate work
65+
66+
You can edit the workflow to customize:
67+
- The glossary file path if it's in a non-standard location
68+
- The scanning timeframe (daily vs weekly)
69+
- The PR title prefix and labels
70+
71+
After editing, run `gh aw compile` to apply your changes.
72+
73+
## What it reads from GitHub
74+
75+
- Recent commits and their diffs
76+
- Merged pull requests from the specified timeframe
77+
- PR descriptions and comments
78+
- Code changes that introduce new terminology
79+
80+
## What it creates
81+
82+
- Pull requests with glossary updates
83+
- Cache memory of processed commits to avoid duplicates
84+
85+
## When it runs
86+
87+
- **Daily on weekdays** (incremental scan of last 24 hours)
88+
- **Mondays** (full scan of last 7 days)
89+
- **Manually** via workflow_dispatch
90+
91+
## Permissions required
92+
93+
- `contents: read` - To read repository files
94+
- `issues: read` - To review issue discussions
95+
- `pull-requests: read` - To analyze PR descriptions
96+
- `actions: read` - To check workflow runs
97+
98+
## Benefits
99+
100+
1. **Automatic maintenance**: Keeps terminology documentation current without manual tracking
101+
2. **Consistency**: Ensures definitions stay aligned with code changes
102+
3. **Accessibility**: Helps new contributors understand project-specific terms
103+
4. **Time savings**: Eliminates manual glossary updates
104+
5. **Historical context**: Uses cache memory to track what's been processed
105+
106+
## Example Output
107+
108+
When the workflow finds new terms, it creates a PR like:
109+
110+
**Title:** `[docs] Update glossary - daily scan`
111+
112+
**Body:**
113+
```markdown
114+
### Glossary Updates
115+
116+
**Scan Type**: Incremental (daily)
117+
118+
**Terms Added**:
119+
- **Safe Outputs**: Security mechanism for controlling workflow write operations
120+
- **Cache Memory**: Persistent storage for workflow state across runs
121+
122+
**Terms Updated**:
123+
- **Frontmatter**: Updated to include new engine configuration options
124+
125+
**Changes Analyzed**:
126+
- Reviewed 5 commits from last 24 hours
127+
- Analyzed 2 merged PRs
128+
- Processed 1 new feature (cache-memory tool)
129+
130+
**Related Changes**:
131+
- abc1234: Add cache-memory tool support
132+
- PR #123: Implement safe-outputs validation
133+
```
134+
135+
## Source
136+
137+
This workflow is adapted from Peli's Agent Factory. Read more: [Meet the Workflows: Continuous Documentation](https://github.github.com/gh-aw/blog/2026-01-13-meet-the-workflows-documentation/)
138+
139+
## Use Cases
140+
141+
This workflow is valuable for:
142+
143+
- **Open source projects** with growing terminology
144+
- **Technical documentation** that needs to stay synchronized with code
145+
- **API projects** with evolving configuration options
146+
- **Developer tools** with CLI commands and options
147+
- **Frameworks** with specialized concepts and patterns
148+
149+
## Future Enhancements
150+
151+
Possible improvements:
152+
- Suggest related terms when adding new definitions
153+
- Detect inconsistent terminology usage across documentation
154+
- Generate glossary if one doesn't exist
155+
- Link term usage to specific code locations
156+
- Track term popularity and usage frequency

0 commit comments

Comments
 (0)