From 1f005ef7fca36260645871d790fa4686a4648f50 Mon Sep 17 00:00:00 2001 From: Jeremy Collins Date: Fri, 17 Oct 2025 08:01:08 -0400 Subject: [PATCH 1/5] Filter out deleted records from API responses - Remove DeletedDateStart/DeletedDateEnd params from Customers, Vehicles, and RepairOrders - Set appointments to exclude deleted by default (includeDeleted=false) - Default repair orders to exclude status 7 (Deleted) in MCP tools layer - Never query for deleted records by removing the ability to filter by deleted dates --- internal/mcp/tools/repair_orders.go | 3 +++ pkg/tekmetric/appointments.go | 10 +++++++--- pkg/tekmetric/customers.go | 10 ++-------- pkg/tekmetric/repair_orders.go | 17 +++++------------ pkg/tekmetric/vehicles.go | 8 -------- 5 files changed, 17 insertions(+), 31 deletions(-) diff --git a/internal/mcp/tools/repair_orders.go b/internal/mcp/tools/repair_orders.go index caa46bf..b060b17 100644 --- a/internal/mcp/tools/repair_orders.go +++ b/internal/mcp/tools/repair_orders.go @@ -122,6 +122,9 @@ func (r *Registry) handleRepairOrders(arguments map[string]interface{}) (*mcp.Ca params.RepairOrderStatusIds = append(params.RepairOrderStatusIds, statusID) } } + } else { + // Default: exclude status 7 (Deleted) + params.RepairOrderStatusIds = []int{1, 2, 3, 4, 5, 6} } if customerID, ok := parseFloatArg(arguments, "customer_id"); ok { params.CustomerID = customerID diff --git a/pkg/tekmetric/appointments.go b/pkg/tekmetric/appointments.go index 4928ae8..2c66ab1 100644 --- a/pkg/tekmetric/appointments.go +++ b/pkg/tekmetric/appointments.go @@ -17,17 +17,18 @@ type AppointmentQueryParams struct { End string `url:"end,omitempty"` // End date filter UpdatedDateStart string `url:"updatedDateStart,omitempty"` // Filter by updated date UpdatedDateEnd string `url:"updatedDateEnd,omitempty"` // Filter by updated date - IncludeDeleted *bool `url:"includeDeleted,omitempty"` // Include deleted appointments (default: true) + IncludeDeleted *bool `url:"includeDeleted,omitempty"` // Include deleted appointments (default: false) Sort string `url:"sort,omitempty"` // Sort field (API docs don't specify allowed values) SortDirection string `url:"sortDirection,omitempty"` // ASC, DESC } -// GetAppointments returns a paginated list of appointments +// GetAppointments returns a paginated list of appointments (excludes deleted by default) func (c *Client) GetAppointments(ctx context.Context, shopID int, page int, size int) (*PaginatedResponse[Appointment], error) { if err := c.isAuthorizedShop(shopID); err != nil { return nil, err } - path := fmt.Sprintf("/api/v1/appointments?shop=%d&page=%d&size=%d", shopID, page, size) + includeDeleted := false + path := fmt.Sprintf("/api/v1/appointments?shop=%d&page=%d&size=%d&includeDeleted=%t", shopID, page, size, includeDeleted) var resp PaginatedResponse[Appointment] if err := c.doRequest(ctx, "GET", path, nil, &resp); err != nil { return nil, err @@ -81,8 +82,11 @@ func (c *Client) GetAppointmentsWithParams(ctx context.Context, params Appointme if params.UpdatedDateEnd != "" { query.Add("updatedDateEnd", params.UpdatedDateEnd) } + // Default to excluding deleted appointments if params.IncludeDeleted != nil { query.Add("includeDeleted", fmt.Sprintf("%t", *params.IncludeDeleted)) + } else { + query.Add("includeDeleted", "false") } if params.Sort != "" { query.Add("sort", params.Sort) diff --git a/pkg/tekmetric/customers.go b/pkg/tekmetric/customers.go index 4a66cfa..c6561f5 100644 --- a/pkg/tekmetric/customers.go +++ b/pkg/tekmetric/customers.go @@ -7,6 +7,7 @@ import ( ) // CustomerQueryParams holds query parameters for customer searches +// Note: By default, deleted records are excluded unless DeletedDateStart/DeletedDateEnd are explicitly set type CustomerQueryParams struct { Shop int `url:"shop,omitempty"` Page int `url:"page,omitempty"` @@ -16,8 +17,6 @@ type CustomerQueryParams struct { OkForMarketing *bool `url:"okForMarketing,omitempty"` // Filter by marketing permission UpdatedDateStart string `url:"updatedDateStart,omitempty"` // Filter by updated date UpdatedDateEnd string `url:"updatedDateEnd,omitempty"` // Filter by updated date - DeletedDateStart string `url:"deletedDateStart,omitempty"` // Filter by deleted date - DeletedDateEnd string `url:"deletedDateEnd,omitempty"` // Filter by deleted date CustomerTypeID int `url:"customerTypeId,omitempty"` // 1=Customer, 2=Business Sort string `url:"sort,omitempty"` // lastName, firstName, email (can be comma-separated) SortDirection string `url:"sortDirection,omitempty"` // ASC, DESC @@ -94,12 +93,7 @@ func (c *Client) GetCustomersWithParams(ctx context.Context, params CustomerQuer if params.UpdatedDateEnd != "" { query.Add("updatedDateEnd", params.UpdatedDateEnd) } - if params.DeletedDateStart != "" { - query.Add("deletedDateStart", params.DeletedDateStart) - } - if params.DeletedDateEnd != "" { - query.Add("deletedDateEnd", params.DeletedDateEnd) - } + // Deleted date filters removed - we never query for deleted records if params.CustomerTypeID > 0 { query.Add("customerTypeId", fmt.Sprintf("%d", params.CustomerTypeID)) } diff --git a/pkg/tekmetric/repair_orders.go b/pkg/tekmetric/repair_orders.go index bbaf9d7..bbc1c0a 100644 --- a/pkg/tekmetric/repair_orders.go +++ b/pkg/tekmetric/repair_orders.go @@ -17,8 +17,6 @@ type RepairOrderQueryParams struct { PostedDateEnd string `url:"postedDateEnd,omitempty"` // Date format: YYYY-MM-DD UpdatedDateStart string `url:"updatedDateStart,omitempty"` // Date format: YYYY-MM-DD UpdatedDateEnd string `url:"updatedDateEnd,omitempty"` // Date format: YYYY-MM-DD - DeletedDateStart string `url:"deletedDateStart,omitempty"` // Date format: YYYY-MM-DD - DeletedDateEnd string `url:"deletedDateEnd,omitempty"` // Date format: YYYY-MM-DD RepairOrderNumber int `url:"repairOrderNumber,omitempty"` RepairOrderStatusIds []int `url:"repairOrderStatusId,omitempty"` // 1-Estimate, 2-WIP, 3-Complete, 4-Saved, 5-Posted, 6-AR, 7-Deleted CustomerID int `url:"customerId,omitempty"` @@ -28,12 +26,13 @@ type RepairOrderQueryParams struct { SortDirection string `url:"sortDirection,omitempty"` // ASC, DESC } -// GetRepairOrders returns a paginated list of repair orders +// GetRepairOrders returns a paginated list of repair orders (excludes deleted status 7 by default) func (c *Client) GetRepairOrders(ctx context.Context, shopID int, page int, size int) (*PaginatedResponse[RepairOrder], error) { params := RepairOrderQueryParams{ - Shop: shopID, - Page: page, - Size: size, + Shop: shopID, + Page: page, + Size: size, + RepairOrderStatusIds: []int{1, 2, 3, 4, 5, 6}, // Exclude status 7 (Deleted) } return c.GetRepairOrdersWithParams(ctx, params) } @@ -75,12 +74,6 @@ func (c *Client) GetRepairOrdersWithParams(ctx context.Context, params RepairOrd if params.UpdatedDateEnd != "" { query.Add("updatedDateEnd", params.UpdatedDateEnd) } - if params.DeletedDateStart != "" { - query.Add("deletedDateStart", params.DeletedDateStart) - } - if params.DeletedDateEnd != "" { - query.Add("deletedDateEnd", params.DeletedDateEnd) - } if params.RepairOrderNumber > 0 { query.Add("repairOrderNumber", fmt.Sprintf("%d", params.RepairOrderNumber)) } diff --git a/pkg/tekmetric/vehicles.go b/pkg/tekmetric/vehicles.go index 560c1a2..17f49d0 100644 --- a/pkg/tekmetric/vehicles.go +++ b/pkg/tekmetric/vehicles.go @@ -15,8 +15,6 @@ type VehicleQueryParams struct { Search string `url:"search,omitempty"` // Search by year, make, model UpdatedDateStart string `url:"updatedDateStart,omitempty"` // Filter by updated date UpdatedDateEnd string `url:"updatedDateEnd,omitempty"` // Filter by updated date - DeletedDateStart string `url:"deletedDateStart,omitempty"` // Filter by deleted date - DeletedDateEnd string `url:"deletedDateEnd,omitempty"` // Filter by deleted date Sort string `url:"sort,omitempty"` // Sort field (API docs don't specify allowed values) SortDirection string `url:"sortDirection,omitempty"` // ASC, DESC } @@ -89,12 +87,6 @@ func (c *Client) GetVehiclesWithParams(ctx context.Context, params VehicleQueryP if params.UpdatedDateEnd != "" { query.Add("updatedDateEnd", params.UpdatedDateEnd) } - if params.DeletedDateStart != "" { - query.Add("deletedDateStart", params.DeletedDateStart) - } - if params.DeletedDateEnd != "" { - query.Add("deletedDateEnd", params.DeletedDateEnd) - } if params.Sort != "" { query.Add("sort", params.Sort) } From bba4aed1d7f60690c4bafb47b481853e136ed465 Mon Sep 17 00:00:00 2001 From: Jeremy Collins Date: Fri, 17 Oct 2025 08:04:20 -0400 Subject: [PATCH 2/5] Add PR workflow to validate builds --- .github/workflows/pr.yml | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..17b77c5 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,47 @@ +name: Pull Request Checks + +on: + pull_request: + branches: [ main ] + +jobs: + build-app: + name: Build Application + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Build application + run: make build + + - name: Run tests + run: go test -v ./... + + build-docs: + name: Build Documentation + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./docs + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + cache-dependency-path: docs/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Build documentation + run: npm run build From fefa974e730981d46a5fe0ded1c7ca8223824d5d Mon Sep 17 00:00:00 2001 From: Jeremy Collins Date: Fri, 17 Oct 2025 08:05:19 -0400 Subject: [PATCH 3/5] Fix broken link in analysis docs --- docs/docs/tools/analysis.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/tools/analysis.md b/docs/docs/tools/analysis.md index b5974b3..6a44d81 100644 --- a/docs/docs/tools/analysis.md +++ b/docs/docs/tools/analysis.md @@ -159,4 +159,4 @@ TEKMETRIC_ANALYSIS_TIMEOUT_SECONDS=120 - [Repair Orders Tool](repair-orders.md) - For quick repair order lookups - [Vehicles Tool](vehicles.md) - For finding vehicle IDs -- [Configuration](../configuration/environment-variables.md) - Analysis tool settings +- [Configuration](../configuration/index.md) - Analysis tool settings From eb30b91664e5f0a852ebb740f55922fb41729ee2 Mon Sep 17 00:00:00 2001 From: Jeremy Collins Date: Fri, 17 Oct 2025 08:06:36 -0400 Subject: [PATCH 4/5] Fix npm cache path in PR workflow --- .github/workflows/pr.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 17b77c5..64cafb1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,9 +26,6 @@ jobs: build-docs: name: Build Documentation runs-on: ubuntu-latest - defaults: - run: - working-directory: ./docs steps: - name: Checkout code uses: actions/checkout@v4 @@ -41,7 +38,9 @@ jobs: cache-dependency-path: docs/package-lock.json - name: Install dependencies + working-directory: ./docs run: npm ci - name: Build documentation + working-directory: ./docs run: npm run build From 63bbdfb79cc0ad4943779c87fc17cad63c8fef71 Mon Sep 17 00:00:00 2001 From: Jeremy Collins Date: Fri, 17 Oct 2025 08:07:53 -0400 Subject: [PATCH 5/5] Use Bun instead of npm for docs build in PR workflow --- .github/workflows/pr.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 64cafb1..0727432 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,21 +26,20 @@ jobs: build-docs: name: Build Documentation runs-on: ubuntu-latest + defaults: + run: + working-directory: ./docs steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v4 + - name: Setup Bun + uses: oven-sh/setup-bun@v2 with: - node-version: '20' - cache: 'npm' - cache-dependency-path: docs/package-lock.json + bun-version: latest - name: Install dependencies - working-directory: ./docs - run: npm ci + run: bun install - name: Build documentation - working-directory: ./docs - run: npm run build + run: bun run build