Skip to content

Commit 0e54817

Browse files
Resolve merge conflicts - include compare_styles_tool and optimize_style_tool
2 parents a84957c + 1d56c7c commit 0e54817

19 files changed

+3994
-108
lines changed

README.md

Lines changed: 241 additions & 107 deletions
Large diffs are not rendered by default.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) Mapbox, Inc.
2+
// Licensed under the MIT License.
3+
4+
import { z } from 'zod';
5+
6+
export const OptimizeStyleInputSchema = z.object({
7+
style: z
8+
.union([z.string(), z.record(z.unknown())])
9+
.describe('Mapbox style to optimize (JSON string or style object)'),
10+
optimizations: z
11+
.array(
12+
z.enum([
13+
'remove-unused-sources',
14+
'remove-duplicate-layers',
15+
'simplify-expressions',
16+
'remove-empty-layers',
17+
'consolidate-filters'
18+
])
19+
)
20+
.optional()
21+
.describe(
22+
'Specific optimizations to apply (if not specified, all optimizations are applied)'
23+
)
24+
});
25+
26+
export type OptimizeStyleInput = z.infer<typeof OptimizeStyleInputSchema>;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) Mapbox, Inc.
2+
// Licensed under the MIT License.
3+
4+
import { z } from 'zod';
5+
6+
const OptimizationSchema = z.object({
7+
type: z.string().describe('Type of optimization applied'),
8+
description: z.string().describe('Description of what was optimized'),
9+
count: z.number().describe('Number of items affected by this optimization')
10+
});
11+
12+
export const OptimizeStyleOutputSchema = z.object({
13+
optimizedStyle: z.record(z.unknown()).describe('The optimized Mapbox style'),
14+
optimizations: z
15+
.array(OptimizationSchema)
16+
.describe('List of optimizations that were applied'),
17+
summary: z.object({
18+
totalOptimizations: z
19+
.number()
20+
.describe('Total number of optimization operations performed'),
21+
originalSize: z.number().describe('Original style size in bytes'),
22+
optimizedSize: z.number().describe('Optimized style size in bytes'),
23+
sizeSaved: z.number().describe('Bytes saved through optimization'),
24+
percentReduction: z.number().describe('Percentage reduction in size')
25+
})
26+
});
27+
28+
export type OptimizeStyleOutput = z.infer<typeof OptimizeStyleOutputSchema>;

0 commit comments

Comments
 (0)