Skip to content

Commit 2a6bea0

Browse files
authored
feat: add backlog-bridge-adapter logic for github initially (#108)
* feat: add GitHub issue state management and branch tracking for applied changes - Fix issue title extraction for archived proposals - Add automatic issue closure for applied/deprecated/discarded proposals - Add state_reason mapping (completed/not_planned) based on proposal status - Add comments when issues are created/closed with status explanations - Add branch information to comments for applied changes - Update issue state even when content hash hasn't changed - Support GitHub issue close reasons (completed, not_planned, duplicate) * feat: add --include-archived flag and improve branch detection - Add --include-archived flag to sync bridge command for updating archived change proposals - Improve branch detection algorithm with change_id-based prioritization - Add flexible matching (exact substring + key words) for better branch identification - Always update comments for applied status when --include-archived is set - Update documentation with new parameter and examples - Update CHANGELOG.md with new features This allows retroactively updating existing GitHub issues with improved comment logic and branch detection algorithms, even for archived change proposals. * Fix failed tests * Apply review fixes * Fix specmatic tests --------- Co-authored-by: Dominikus Nold <djm81@users.noreply.github.com>
1 parent 73dc6bf commit 2a6bea0

30 files changed

+5946
-248
lines changed

CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,75 @@ All notable changes to this project will be documented in this file.
99

1010
---
1111

12+
## [0.25.0] - 2026-01-15
13+
14+
### Added (0.25.0)
15+
16+
- **Archived Change Proposal Sync**: New `--include-archived` flag for `sync bridge` command
17+
- **Purpose**: Include archived change proposals in sync to update existing GitHub issues with new comment logic and branch detection improvements
18+
- **Use Case**: When you improve comment formatting or branch detection algorithms, update historical issues retroactively
19+
- **Behavior**: When `--include-archived` is set with `--update-existing`, archived proposals are included and comments are always updated for applied status
20+
- **Example**: `specfact sync bridge --adapter github --mode export-only --include-archived --update-existing`
21+
- **Documentation**: See `docs/guides/devops-adapter-integration.md#updating-archived-change-proposals`
22+
23+
- **Improved Branch Detection**: Enhanced branch detection algorithm for GitHub issue comments
24+
- **Prioritization**: Branches matching the change_id in their name are now prioritized
25+
- **Flexible Matching**: Uses both exact substring matching and key words matching (e.g., "change" and "tracking" from "add-code-change-tracking")
26+
- **Accuracy**: Correctly identifies implementation branches even when multiple branches contain the same commits
27+
- **Use Case**: Ensures GitHub issue comments show the correct implementation branch for applied changes
28+
29+
- **Backlog Adapter Import Capability**: GitHub adapter now supports importing GitHub Issues as OpenSpec change proposals
30+
- **New Method**: `import_artifact("github_issue", issue_data, project_bundle, bridge_config)` in `GitHubAdapter`
31+
- **Parsing**: Parses GitHub issue body/markdown to extract change proposal data (Why, What Changes sections)
32+
- **Status Mapping**: Maps GitHub labels to OpenSpec change status (tool-agnostic pattern)
33+
- **Metadata Storage**: Stores GitHub issue metadata in `source_tracking` (tool-agnostic pattern)
34+
- **Extensibility**: Reusable patterns for future backlog adapters (ADO, Jira, Linear)
35+
- **Documentation**: See `docs/adapters/github.md` and `docs/adapters/backlog-adapter-patterns.md`
36+
37+
- **Bidirectional Status Synchronization**: GitHub adapter now supports bidirectional status sync
38+
- **New Methods**: `sync_status_to_github()` and `sync_status_from_github()` in `GitHubAdapter`
39+
- **Conflict Resolution**: Three strategies: `prefer_openspec`, `prefer_backlog`, `merge` (most advanced)
40+
- **Label Updates**: Automatically updates GitHub issue labels based on OpenSpec change status
41+
- **Status Mapping**: Tool-agnostic status mapping interface for future backlog adapters
42+
- **Documentation**: See `docs/adapters/github.md` for usage examples
43+
44+
- **Backlog Adapter Extensibility Pattern**: Reusable base class for implementing backlog adapters
45+
- **New Module**: `src/specfact_cli/adapters/backlog_base.py` with `BacklogAdapterMixin`
46+
- **Abstract Methods**: Tool-agnostic interfaces for status mapping and metadata extraction
47+
- **Reusable Utilities**: Conflict resolution, source tracking creation, import workflow
48+
- **Documentation**: See `docs/adapters/backlog-adapter-patterns.md` for implementation guide
49+
- **Future Adapters**: Patterns documented for ADO, Jira, Linear implementations
50+
51+
- **Validation Integration with Change Proposals**: SpecFact validation now integrates with OpenSpec change proposals
52+
- **New Module**: `src/specfact_cli/validators/change_proposal_integration.py`
53+
- **Change Proposal Loading**: `load_active_change_proposals()` loads active proposals (proposed/in-progress)
54+
- **Spec Merging**: `merge_specs_with_change_proposals()` merges current Spec-Kit specs with proposed OpenSpec changes
55+
- **Status Updates**: `update_validation_status()` updates validation status in change proposals
56+
- **Result Reporting**: `report_validation_results_to_backlog()` reports validation results to GitHub Issues
57+
- **Conflict Detection**: Detects and reports conflicts when same requirement modified in multiple proposals
58+
- **Cross-Repo Support**: Supports external OpenSpec repositories via `bridge_config.external_base_path`
59+
- **Documentation**: See `docs/validation-integration.md` for complete integration guide
60+
61+
- **Integration Test Suite**: Comprehensive integration tests for adapter workflows
62+
- **Backlog Sync Tests**: `tests/integration/sync/test_backlog_sync.py` - Bidirectional backlog sync (GitHub)
63+
- **Validation Integration Tests**: `tests/integration/specfact_cli/validators/test_change_proposal_validation.py` - Validation with change proposals
64+
- **Test Patterns**: Reusable test patterns for future backlog adapters (ADO, Jira, Linear)
65+
- **Coverage**: Tests cover export, import, status sync, conflict resolution, and validation integration
66+
67+
### Changed (0.25.0)
68+
69+
- **GitHub Adapter Capabilities**: Updated `get_capabilities()` to reflect bidirectional sync support
70+
- **Before**: `supported_sync_modes=["export-only"]`
71+
- **After**: `supported_sync_modes=["bidirectional"]`
72+
- **Impact**: Adapter now supports both export and import operations
73+
74+
### Documentation (0.25.0)
75+
76+
- **New Documentation**: `docs/validation-integration.md` - Complete guide for validation integration with change proposals
77+
- **New Documentation**: `docs/adapters/backlog-adapter-patterns.md` - Patterns for implementing future backlog adapters
78+
- **New Documentation**: `docs/adapters/github.md` - GitHub adapter reference with usage examples
79+
- **Updated Documentation**: Adapter documentation updated with import capability and bidirectional sync
80+
1281
## [0.24.1] - 2026-01-12
1382

1483
### Fixed (0.24.1)

docs/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ SpecFact isn't just a technical tool—it's designed for **real-world agile/scru
1616

1717
**Each role works in their own Markdown files** (no YAML editing), and SpecFact syncs everything together automatically. Perfect for teams using agile/scrum practices with clear role separation.
1818

19-
👉 **[Agile/Scrum Workflows Guide](guides/agile-scrum-workflows.md)****START HERE** - Complete guide to persona-based team collaboration
19+
**🆕 NEW: DevOps Backlog Integration** - SpecFact now integrates directly into your agile DevOps workflows! Bidirectionally sync OpenSpec change proposals with GitHub Issues, track implementation progress automatically, and keep your backlog in sync with your specifications.
20+
21+
👉 **[Agile/Scrum Workflows Guide](guides/agile-scrum-workflows.md)****START HERE** - Complete guide to persona-based team collaboration
22+
👉 **[DevOps Backlog Integration](guides/devops-adapter-integration.md)** 🆕 **NEW FEATURE** - Integrate SpecFact into agile DevOps workflows
2023

2124
---
2225

@@ -32,7 +35,7 @@ SpecFact isn't just a technical tool—it's designed for **real-world agile/scru
3235
-**Brownfield-first** → Spec-Kit/OpenSpec excel at new features; SpecFact understands existing code
3336
-**Formal verification** → Spec-Kit/OpenSpec use LLM suggestions; SpecFact uses mathematical proof (CrossHair)
3437
-**Team collaboration** → Spec-Kit is single-user focused; SpecFact supports persona-based workflows for agile teams
35-
-**DevOps integration** → Bridge adapters sync change proposals to GitHub Issues, ADO, Linear, Jira
38+
-**DevOps integration** 🆕 → **Bidirectional backlog sync** - Sync change proposals to GitHub Issues (and future: ADO, Linear, Jira) with automatic progress tracking
3639
-**GitHub Actions integration** → Works seamlessly with your existing GitHub workflows
3740

3841
**Perfect together:**
@@ -93,14 +96,15 @@ specfact enforce sdd --bundle my-project
9396

9497
### Working with an Agile/Scrum Team?
9598

96-
**Primary Goal**: Enable team collaboration with role-based workflows
99+
**Primary Goal**: Enable team collaboration with role-based workflows and DevOps integration
97100

98101
1. **[Agile/Scrum Workflows](guides/agile-scrum-workflows.md)****START HERE** - Persona-based team collaboration
99-
2. **[Command Reference - Project Commands](reference/commands.md#project---project-bundle-management)** - `project export` and `project import` commands
100-
3. **[Persona Workflows](guides/agile-scrum-workflows.md#persona-based-workflows)** - How Product Owners, Architects, and Developers work together
101-
4. **[Definition of Ready](guides/agile-scrum-workflows.md#definition-of-ready-dor)** - DoR validation and sprint planning
102+
2. **[DevOps Backlog Integration](guides/devops-adapter-integration.md)** 🆕 **NEW FEATURE** - Integrate SpecFact into your agile DevOps workflows with bidirectional GitHub Issues sync
103+
3. **[Command Reference - Project Commands](reference/commands.md#project---project-bundle-management)** - `project export` and `project import` commands
104+
4. **[Persona Workflows](guides/agile-scrum-workflows.md#persona-based-workflows)** - How Product Owners, Architects, and Developers work together
105+
5. **[Definition of Ready](guides/agile-scrum-workflows.md#definition-of-ready-dor)** - DoR validation and sprint planning
102106

103-
**Time**: 15-30 minutes | **Result**: Understanding how your team can collaborate with SpecFact
107+
**Time**: 15-30 minutes | **Result**: Understanding how your team can collaborate with SpecFact and integrate with your DevOps backlog
104108

105109
---
106110

@@ -178,8 +182,8 @@ specfact enforce sdd --bundle my-project
178182

179183
- [Spec-Kit Journey](guides/speckit-journey.md) - Add enforcement to Spec-Kit projects
180184
- [Spec-Kit Comparison](guides/speckit-comparison.md) - Understand when to use each tool
181-
- [OpenSpec Journey](guides/openspec-journey.md) 🆕 - OpenSpec integration with SpecFact (DevOps export ✅, bridge adapter )
182-
- [DevOps Adapter Integration](guides/devops-adapter-integration.md) - GitHub Issues, backlog tracking, and progress comments
185+
- [OpenSpec Journey](guides/openspec-journey.md) 🆕 - OpenSpec integration with SpecFact (DevOps export ✅, bridge adapter )
186+
- [DevOps Adapter Integration](guides/devops-adapter-integration.md) 🆕 **NEW FEATURE** - Bidirectional GitHub Issues sync, automatic progress tracking, and agile DevOps workflow integration
183187
- [Bridge Adapters](reference/commands.md#sync-bridge) - OpenSpec and DevOps integration
184188

185189
#### Team Collaboration & Agile/Scrum

0 commit comments

Comments
 (0)