refactor: replace inline API client with flashduty-sdk#40
Open
refactor: replace inline API client with flashduty-sdk#40
Conversation
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.
cdcde01 to
b4fa911
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pkg/flashduty/withflashduty-sdk(v0.3.0)Deleted
pkg/flashduty/types.go(280 lines) -- all 30+ domain types now in SDKpkg/flashduty/enrichment.go(696 lines) -- all enrichment logic now SDK-internalClientstruct,makeRequest,parseResponse,handleAPIErrorfromclient.goRewritten (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 SDKUpdated
client.go: reduced toGetFlashdutyClientFntype alias (~10 lines)context.go: createssdk.ClientwithWithRequestHookfor trace contextformat.go: delegates serialization tosdk.Marshale2e/e2e_test.go: usessdk.NewClientdirectlyDependency changes
github.com/flashcatcloud/flashduty-sdk v0.3.0toon-go,golang.org/x/synclogrusTest plan
make test-- unit tests pass (including tool schema snapshots)make lint-- 0 issuesgo build/go vet-- clean10.99.1.110:11480)