Commit graph

8 commits

Author SHA1 Message Date
Jozef Izso
42064c46fe
Sync Linear milestones as local epics (#3528) 2026-05-05 07:45:30 -07:00
Harry
3ae2ef3a5a feat: multi-project/team support for Linear, Jira, and ADO
Add support for syncing issues across multiple projects/teams in all
three tracker integrations, with shared infrastructure to avoid
duplicating logic.

Shared infrastructure (internal/tracker/multiproject.go):
- ParseCommaSeparated: splits comma-separated config values
- DeduplicateStrings: removes duplicates preserving order
- ResolveProjectIDs: config precedence (CLI > plural > singular)

Linear (closes #2791):
- Tracker: map[string]*Client with per-team routing
- FetchIssues iterates all teams, deduplicates by issue ID
- UpdateIssue routes to owning team via FetchIssueByIdentifier
- Config: linear.team_ids / LINEAR_TEAM_IDS + --team flag

Jira:
- projectKey string → projectKeys []string
- FetchIssues uses JQL IN clause (single query, no iteration)
- Config: jira.projects / JIRA_PROJECTS + --project flag

ADO:
- project string → projects []string
- WIQL uses TeamProject IN clause (single query)
- Config: ado.projects / AZURE_DEVOPS_PROJECTS + --project flag

All singular config keys remain supported for backward compatibility.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-28 13:40:39 -07:00
beads/crew/emma
5a5407fafe refactor: wire Linear/GitLab CLI through SyncEngine, delete duplicated sync code
Phase 4 of the tracker engine migration. Rewrites `bd linear sync` and
`bd gitlab sync` to use the shared tracker.Engine instead of bespoke
pull/push/conflict-detection functions.

- Rewrite runLinearSync: create tracker → set hooks → Engine.Sync()
- Add buildLinearPullHooks (hash-based ID generation with collision avoidance)
- Add buildLinearPushHooks (FormatDescription, ContentEqual, StateCache, ShouldPush)
- Add BuildStateCacheFromTracker to internal/linear for CLI hook access
- Rewrite runGitLabSync: create tracker → set hooks → Engine.Sync()
- Add buildGitLabPullHooks (timestamp-counter-random ID generation)
- Add conflict-aware pull to Engine (skip locally-modified issues when prefer-local)
- Delete linear_sync.go (419 lines), linear_conflict.go (191 lines), gitlab_sync.go (563 lines)
- Remove tests for deleted sync functions (covered by engine_test.go)
- Keep utility function tests (generateIssueID, parseGitLabSourceSystem, getConflictStrategy)

Net: -2077 lines. CLI is now thin: parse flags, create tracker, call Engine.Sync().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-14 17:29:05 -08:00
beads/crew/collins
d89a790a2b fix: bd init falls back to JSONL mode when CGO unavailable (dolt-ea0sh)
Windows CI builds with CGO_ENABLED=0, so the Dolt backend is unavailable.
Previously bd init would fail with "dolt backend requires CGO". Now it
detects the CGO error and falls back to --no-db (JSONL-only) mode
automatically, enabling the full CRUD smoke test to pass.

Also fixes a copy-paste bug at init.go:355 where the else branch
hardcoded configfile.BackendDolt instead of using the backend variable.

Adds missing //go:build cgo tags to 26 test files that reference
CGO-only types/helpers, preventing compilation failures on nocgo builds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 18:06:58 -08:00
beads/crew/lizzy
2bb827facb style: run gofmt across entire codebase (bd-nmk12)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:35:20 -08:00
chrismilleruk
d8f5e1f1fc
fix(linear): exclude ephemeral issues from sync push by default (#1397)
Related to #1204, #1205. Linear sync was including local-only ephemeral beads (wisps, etc.), causing noise. We now exclude them by default using the `ephemeral` field.

- Exclude ephemeral issues from push to Linear by default.
- Add `--include-ephemeral` flag to override when needed.
2026-01-30 22:18:48 -08:00
Zachary Piazza
ee44498659
feat(linear): add --type and --exclude-type flags for sync filtering (#1205)
* feat(linear): add --type and --exclude-type flags for sync filtering

Add type filtering support to `bd linear sync --push` to allow users to
control which issue types are synced to Linear.

New flags:
- --type: Only sync issues matching these types (e.g., --type=task,feature)
- --exclude-type: Exclude issues of these types (e.g., --exclude-type=wisp)

Use cases:
- Sync only work items (tasks, features, bugs) while excluding internal
  telemetry (wisps, messages)
- Push only specific issue types to Linear

Fixes #1204

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(linear): update test to match new doPushToLinear signature

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 14:05:48 -08:00
Justin Williams
df5ceb5d82
feat: Linear Integration (#655)
* Add Linear integration CLI with sync and status commands

- Add `bd linear sync` for bidirectional issue sync with Linear
- Add `bd linear status` to show configuration and sync state
- Stub pull/push functions pending GraphQL client (bd-b6b.2)

* Implement Linear GraphQL client with full sync support

- Add LinearClient with auth, fetch, create, update methods
- Implement pull/push operations with Beads type mapping
- Clean up redundant comments and remove unused code

* Add configurable data mapping and dependency sync for Linear

- Add LinearMappingConfig with configurable priority/state/label/relation maps
- Import parent-child and issue relations as Beads dependencies
- Support custom workflow states via linear.state_map.* config

* Add incremental sync support for Linear integration

- Add FetchIssuesSince() method using updatedAt filter in GraphQL
- Check linear.last_sync config to enable incremental pulls
- Track sync mode (incremental vs full) in LinearPullStats

* feat(linear): implement push updates for existing Linear issues

Add FetchIssueByIdentifier method to retrieve single issues by identifier
(e.g., "TEAM-123") for timestamp comparison during push.

Update doPushToLinear to:
- Fetch Linear issue to get internal ID and UpdatedAt timestamp
- Compare timestamps: only update if local is newer
- Build update payload with title, description, priority, and state
- Call UpdateIssue for issues where local has newer changes

Closes bd-b6b.5

* Implement Linear conflict resolution strategies

- Add true conflict detection by fetching Linear timestamps via API
- Implement --prefer-linear resolution (re-import from Linear)
- Implement timestamp-based resolution (newer wins as default)
- Fix linter issues: handle resp.Body.Close() and remove unused error return

* Add Linear integration tests and documentation

- Add comprehensive unit tests for Linear mapping (priority, state, labels, relations)
- Update docs/CONFIG.md with Linear configuration reference
- Add examples/linear-workflow guide for bidirectional sync
- Remove AI section header comments from tests

* Fix Linear GraphQL filter construction and improve test coverage

- Refactor filter handling to combine team ID into main filter object
- Add test for duplicate issue relation mapping
- Add HTTP round-trip helper for testing request payload validation

* Refactor Linear queries to use shared constant and add UUID validation

- Extract linearIssuesQuery to deduplicate FetchIssues/FetchIssuesSince
- Add linearMaxPageSize constant and UUID validation with regex
- Expand test coverage for new functionality

* Refactor Linear integration into internal/linear package

- Extract types, client, and mapping logic from cmd/bd/linear.go
- Create internal/linear/ package for better code organization
- Update tests to work with new package structure

* Add linear teams command to list available teams

- Add FetchTeams GraphQL query to Linear client
- Refactor config reading to support daemon mode
- Add tests for teams listing functionality

* Refactor Linear config to use getLinearConfig helper

- Consolidate config/env var lookup using getLinearConfig function
- Add LINEAR_TEAM_ID environment variable support
- Update error messages to include env var configuration options

* Add hash ID generation and improve Linear conflict detection

- Add configurable hash ID mode for Linear imports (matches bd/Jira)
- Improve conflict detection with content hash comparison
- Enhance conflict resolution with skip/force update tracking

* Fix test for updated doPushToLinear signature

- Add missing skipUpdateIDs parameter to test call
2025-12-19 17:58:24 -08:00