Skip to content

refactor: replace inline API client with flashduty-sdk#40

Open
debidong wants to merge 4 commits intomainfrom
feat/sdk-integration
Open

refactor: replace inline API client with flashduty-sdk#40
debidong wants to merge 4 commits intomainfrom
feat/sdk-integration

Conversation

@debidong
Copy link
Copy Markdown

@debidong debidong commented Apr 8, 2026

Summary

  • Replace the entire duplicate API client layer in pkg/flashduty/ with flashduty-sdk (v0.3.0)
  • Tool handlers are now thin wrappers: parse MCP params, call SDK methods, format results
  • Net change: +409 / -2,640 lines (-2,231 lines removed)

Deleted

  • pkg/flashduty/types.go (280 lines) -- all 30+ domain types now in SDK
  • pkg/flashduty/enrichment.go (696 lines) -- all enrichment logic now SDK-internal
  • Client struct, makeRequest, parseResponse, handleAPIError from client.go

Rewritten (22 tool handlers across 7 files)

  • incidents.go (823 -> 430), users.go (233 -> 118), channels.go (453 -> 97)
  • changes.go (172 -> 69), statuspage.go (391 -> 210), fields.go (112 -> 53)
  • templates.go (437 -> 161) -- static data now from SDK

Updated

  • client.go: reduced to GetFlashdutyClientFn type alias (~10 lines)
  • context.go: creates sdk.Client with WithRequestHook for trace context
  • format.go: delegates serialization to sdk.Marshal
  • e2e/e2e_test.go: uses sdk.NewClient directly

Dependency changes

  • Added: github.com/flashcatcloud/flashduty-sdk v0.3.0
  • Demoted to indirect: toon-go, golang.org/x/sync
  • Removed: logrus

Test plan

  • make test -- unit tests pass (including tool schema snapshots)
  • make lint -- 0 issues
  • go build / go vet -- clean
  • E2E tests (12/12 pass against testing env 10.99.1.110:11480)
    • Incident lifecycle: create -> ack -> close
    • Query: channels, members, incidents, teams, fields, changes
    • Incident update and timeline query
    • Toolset filtering and read-only mode

debidong added 2 commits April 8, 2026 16:48
Replace the entire duplicate API client layer in pkg/flashduty/ with
the flashduty-sdk (v0.3.0). Tool handlers are now thin wrappers that
parse MCP params, call SDK methods, and format results.

Deleted:
- pkg/flashduty/types.go (280 lines) -- all types now in SDK
- pkg/flashduty/enrichment.go (696 lines) -- all enrichment now SDK-internal
- Client struct, makeRequest, parseResponse, handleAPIError from client.go

Rewritten (22 tool handlers across 7 files):
- incidents.go, users.go, channels.go, changes.go, statuspage.go,
  fields.go, templates.go -- all delegate to SDK methods

Updated:
- client.go: reduced to GetFlashdutyClientFn type alias
- context.go: creates sdk.Client with WithRequestHook for trace context
- format.go: delegates serialization to sdk.Marshal
- e2e tests: use sdk.NewClient directly

Net change: -2,392 lines. toon-go and golang.org/x/sync demoted to
indirect deps. logrus removed entirely.
@debidong debidong force-pushed the feat/sdk-integration branch from cdcde01 to b4fa911 Compare April 8, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant