Skip to content

Commit 05e9331

Browse files
authored
Add AWS Spot Placement Scores support (#5)
* Add AWS Spot Placement Scores core functionality - Add score.go with AWS EC2 spot placement score integration - Extend types.go with score-related data structures - Add comprehensive types_test.go with score functionality tests - Implements region and AZ-level score fetching with timeout handling * Integrate spot placement scores into client layer - Update client.go with score enrichment capability - Add comprehensive client_test.go coverage for score features - Regenerate mocks_test.go for new scoring interfaces - Enables score filtering, sorting, and regional/AZ-level fetching * Add CLI flags and UI for AWS Spot Placement Scores - Add --with-score, --min-score, --az, --score-timeout flags - Implement color-coded score display (🟢/🔴 indicators) - Add score sorting and filtering in CLI interface - Update tests for new scoring command-line functionality * Extend MCP server with spot placement score capabilities - Update MCP tools to support score parameters and filtering - Add score enrichment to MCP tool responses - Refactor and streamline MCP test coverage - Enable score features in Model Context Protocol interface * Add comprehensive documentation for spot placement scores - Add aws-spot-placement-scores.md with detailed API documentation - Update usage.md with score filtering examples and CLI options - Extend examples.md with score-based use cases and scenarios - Update mcp-server.md with score parameter documentation - Enhance data-sources.md and api-reference.md for score features * Update dependencies and tooling configuration - Update go.mod/go.sum with AWS SDK dependencies for score API - Enhance .golangci.yaml with additional linting rules - Update .mockery.yaml for new scoring interfaces - Ensure compatibility with score enrichment dependencies * Update README with AWS Spot Placement Scores documentation - Add score feature overview and benefits section - Include score CLI examples and usage scenarios - Document score filtering, sorting, and visualization features - Streamline README structure with focus on core functionality
1 parent f8e328d commit 05e9331

24 files changed

+3760
-1420
lines changed

.golangci.yaml

Lines changed: 54 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ linters:
66
enable:
77
- shadow
88
- fieldalignment
9-
revive:
10-
min-confidence: 0
119
gocyclo:
1210
min-complexity: 15
1311
cyclop:
1412
max-complexity: 15
1513
package-average: 10.0
16-
skip-tests: true
1714
dupl:
1815
threshold: 100
1916
goconst:
@@ -67,13 +64,20 @@ linters:
6764
- $all
6865
allow:
6966
- $gostd
70-
- spotinfo/pkg/spot
67+
- spotinfo/internal/spot
7168
- spotinfo/internal
69+
- spotinfo/internal/mcp
7270
- github.com/jedib0t/go-pretty/v6
7371
- github.com/urfave/cli/v2
7472
- github.com/stretchr/testify
7573
- github.com/mark3labs/mcp-go
7674
- github.com/spf13/cast
75+
- github.com/bluele/gcache
76+
- golang.org/x/time
77+
- github.com/aws/aws-sdk-go-v2
78+
- github.com/aws/smithy-go
79+
- github.com/jedib0t/go-pretty/v6/table
80+
- github.com/jedib0t/go-pretty/v6/text
7781
testifylint:
7882
enable-all: true
7983
tagalign:
@@ -85,53 +89,53 @@ linters:
8589
default: none
8690
enable:
8791
# Essential bug-finding linters
88-
- errcheck # Check for unchecked errors
89-
- gosec # Security issues
90-
- govet # Go vet built-in checks
91-
- ineffassign # Ineffective assignments
92-
- staticcheck # Comprehensive static analysis
93-
- unused # Unused code
94-
- errorlint # Error wrapping issues
95-
92+
- errcheck # Check for unchecked errors
93+
- gosec # Security issues
94+
- govet # Go vet built-in checks
95+
- ineffassign # Ineffective assignments
96+
- staticcheck # Comprehensive static analysis
97+
- unused # Unused code
98+
- errorlint # Error wrapping issues
99+
96100
# Code quality and best practices
97-
- bodyclose # HTTP response body close check
98-
- contextcheck # Context usage patterns
99-
- copyloopvar # Loop variable copying issues
100-
- cyclop # Cyclomatic complexity
101-
- depguard # Import restrictions
102-
- dupl # Code duplication
103-
- exhaustive # Switch statement exhaustiveness
104-
- funlen # Function length
105-
- goconst # Repeated strings that could be constants
106-
- gocritic # Comprehensive go code critic
107-
- gocyclo # Cyclomatic complexity
108-
- makezero # Slice initialization
109-
- nakedret # Naked returns
110-
- nestif # Nested if statements
111-
- nilerr # Nil error returns
112-
- nilnil # Nil error and value returns
113-
- noctx # HTTP without context
114-
- predeclared # Predeclared identifier shadowing
115-
- rowserrcheck # SQL rows.Err() check
116-
- sqlclosecheck # SQL close checks
117-
- unconvert # Unnecessary conversions
118-
- unparam # Unused parameters
119-
- wastedassign # Wasted assignments
120-
101+
- bodyclose # HTTP response body close check
102+
- contextcheck # Context usage patterns
103+
- copyloopvar # Loop variable copying issues
104+
- cyclop # Cyclomatic complexity
105+
- depguard # Import restrictions
106+
- dupl # Code duplication
107+
- exhaustive # Switch statement exhaustiveness
108+
- funlen # Function length
109+
- goconst # Repeated strings that could be constants
110+
- gocritic # Comprehensive go code critic
111+
- gocyclo # Cyclomatic complexity
112+
- makezero # Slice initialization
113+
- nakedret # Naked returns
114+
- nestif # Nested if statements
115+
- nilerr # Nil error returns
116+
- nilnil # Nil error and value returns
117+
# - noctx # HTTP without context - disabled: too verbose for initialization and error handling code
118+
- predeclared # Predeclared identifier shadowing
119+
- rowserrcheck # SQL rows.Err() check
120+
- sqlclosecheck # SQL close checks
121+
- unconvert # Unnecessary conversions
122+
- unparam # Unused parameters
123+
- wastedassign # Wasted assignments
124+
121125
# Performance-related
122-
- prealloc # Slice preallocation
123-
126+
- prealloc # Slice preallocation
127+
124128
# Additional best practices (keep important ones)
125-
- durationcheck # Duration multiplication
126-
- errname # Error naming conventions
127-
- interfacebloat # Interface size
128-
- maintidx # Maintainability index
129-
- mirror # Wrong mirror patterns
130-
- mnd # Magic numbers
131-
- nilnesserr # Nil check patterns
129+
- durationcheck # Duration multiplication
130+
- errname # Error naming conventions
131+
- interfacebloat # Interface size
132+
- maintidx # Maintainability index
133+
- mirror # Wrong mirror patterns
134+
- mnd # Magic numbers
135+
- nilnesserr # Nil check patterns
132136
- nosprintfhostport # Sprintf host:port misuse
133-
- reassign # Package variable reassignment
134-
- forcetypeassert # Type assertion without check
137+
- reassign # Package variable reassignment
138+
- forcetypeassert # Type assertion without check
135139

136140
# Explicitly disabled linters with reasons
137141
# - gochecknoglobals # Too restrictive for CLI apps that need global flags/config
@@ -196,4 +200,6 @@ formatters:
196200
- default
197201
- prefix(spotinfo)
198202
goimports:
199-
local-prefixes: spotinfo
203+
local-prefixes:
204+
- spotinfo
205+

.mockery.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ packages:
77
interfaces:
88
advisorProvider:
99
pricingProvider:
10+
scoreProvider:
11+
awsAPIProvider:
1012
spotinfo/cmd/spotinfo:
1113
interfaces:
12-
SpotClient:
14+
spotClient:
1315
spotinfo/internal/mcp:
1416
interfaces:
1517
spotClient:

0 commit comments

Comments
 (0)