Skip to content

Commit eb182b9

Browse files
committed
refactor: rename enhanced scripts and update tool metadata for consistency
1 parent ce61b2a commit eb182b9

File tree

8 files changed

+110
-67
lines changed

8 files changed

+110
-67
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ src/
200200
└── index.ts # Main server entry point
201201
202202
scripts/
203-
├── validate-build-enhanced.sh # Build validation with operational transparency
204-
├── dependency-manager-enhanced.sh # Dependency analysis with cross-platform support
203+
├── validate-build.sh # Build validation with operational transparency
204+
├── dependency-manager.sh # Dependency analysis with cross-platform support
205205
├── deps-crossplatform.sh # Cross-platform dependency operations
206206
├── monitor.sh # System monitoring and health checks
207207
└── deps.sh # Legacy dependency scripts

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@rollup/plugin-json": "^6.1.0",
1919
"@rollup/plugin-node-resolve": "^16.0.1",
2020
"@rollup/plugin-replace": "^6.0.2",
21+
"@rollup/plugin-terser": "^0.4.4",
2122
"@rollup/plugin-typescript": "^12.1.4",
2223
"@types/express": "^5.0.3",
2324
"@types/jest": "^30.0.0",
@@ -41,7 +42,6 @@
4142
"rollup": "^4.50.2",
4243
"rollup-plugin-dts": "^6.2.3",
4344
"rollup-plugin-preserve-shebang": "^1.0.1",
44-
"rollup-plugin-terser": "^7.0.2",
4545
"ts-jest": "^29.4.2",
4646
"ts-morph": "^27.0.0",
4747
"ts-node": "^10.9.2",
@@ -68,11 +68,11 @@
6868
"scripts": {
6969
"build": "yarn clean && rollup -c",
7070
"build:dev": "yarn clean && rollup -c --environment NODE_ENV:development",
71-
"build:validate": "sh -c 'bash scripts/validate-build-enhanced.sh'",
71+
"build:validate": "sh -c 'bash scripts/validate-build.sh'",
7272
"build:watch": "yarn clean && rollup -c --watch",
7373
"clean": "rimraf dist",
7474
"deps": "sh -c 'bash scripts/deps.sh'",
75-
"deps:analyze": "sh -c 'bash scripts/dependency-manager-enhanced.sh'",
75+
"deps:analyze": "sh -c 'bash scripts/dependency-manager.sh'",
7676
"deps:audit": "sh -c 'bash scripts/deps.sh audit'",
7777
"deps:backup": "sh -c 'bash scripts/deps-crossplatform.sh backup'",
7878
"deps:check": "sh -c 'bash scripts/dependency-manager.sh --dry-run'",

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import typescript from '@rollup/plugin-typescript';
2020
import nodeResolve from '@rollup/plugin-node-resolve';
2121
import commonjs from '@rollup/plugin-commonjs';
2222
import json from '@rollup/plugin-json';
23-
import { terser } from 'rollup-plugin-terser';
23+
import terser from '@rollup/plugin-terser';
2424
import replace from '@rollup/plugin-replace';
2525
import preserveShebang from 'rollup-plugin-preserve-shebang';
2626
import dts from 'rollup-plugin-dts';

scripts/dependency-manager.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,4 +806,4 @@ parse_args_enhanced() {
806806

807807
# Enhanced entry point - simplified
808808
parse_args_enhanced "$@"
809-
main_enhanced
809+
main_enhanced

src/tools/get_entities.tool.test.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,21 @@ describe('GetEntitiesTool', () => {
115115

116116
// FormattedTextResponse returns formatted text, not JSON
117117
const responseText = result.content[0].text;
118-
expect(responseText).toContain('Found 1 entities');
119-
expect(responseText).toContain('Component: 1');
118+
const expectedResponseText = {
119+
status: 'success',
120+
data: {
121+
items: [
122+
{
123+
apiVersion: 'backstage.io/v1alpha1',
124+
kind: 'Component',
125+
metadata: { name: 'comp1', namespace: 'default' },
126+
spec: { type: 'service' },
127+
},
128+
],
129+
},
130+
};
131+
132+
expect(responseText).toEqual(JSON.stringify(expectedResponseText, null, 2));
120133
});
121134

122135
it('should call the catalog client getEntitiesJsonApi method with jsonapi format', async () => {

src/tools/get_entities.tool.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { ApiStatus } from '../types/apis.js';
2424
import { ToolName } from '../types/constants.js';
2525
import { IToolRegistrationContext } from '../types/tools.js';
2626
import { logger } from '../utils/core/logger.js';
27-
import { formatEntityList, FormattedTextResponse, JsonToTextResponse } from '../utils/formatting/responses.js';
27+
import { JsonToTextResponse } from '../utils/formatting/responses.js';
2828
import { ToolErrorHandler } from '../utils/tools/tool-error-handler.js';
2929

3030
const entityFilterSchema = z.object({
@@ -77,17 +77,12 @@ export class GetEntitiesTool {
7777
status: ApiStatus.SUCCESS,
7878
data: jsonApiResult,
7979
});
80-
} else if (req.format === 'standard') {
81-
// Use the old formatted text response for 'standard' format
82-
const result = await ctx.catalogClient.getEntities(sanitizedRequest);
83-
logger.debug('Returning standard formatted entities', { count: result.items?.length || 0 });
84-
return FormattedTextResponse({ status: ApiStatus.SUCCESS, data: result.items }, formatEntityList);
85-
} else {
86-
// Default to JSON format for better LLM access
87-
const result = await ctx.catalogClient.getEntities(sanitizedRequest);
88-
logger.debug('Returning JSON formatted entities', { count: result.items?.length || 0 });
89-
return JsonToTextResponse({ status: ApiStatus.SUCCESS, data: result });
9080
}
81+
82+
// Default to JSON format for better LLM access
83+
const result = await ctx.catalogClient.getEntities(sanitizedRequest);
84+
logger.debug('Returning JSON formatted entities', { count: result.items?.length || 0 });
85+
return JsonToTextResponse({ status: ApiStatus.SUCCESS, data: result });
9186
},
9287
request,
9388
context,

tools-manifest.json

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,103 @@
22
{
33
"name": "add_location",
44
"description": "Create a new location in the catalog.",
5-
"params": ["type", "target"]
5+
"params": [
6+
"type",
7+
"target"
8+
]
69
},
710
{
811
"name": "get_entities_by_query",
912
"description": "Get entities by query filters.",
10-
"params": ["filter", "fields", "limit", "offset", "order"]
13+
"params": [
14+
"filter",
15+
"fields",
16+
"limit",
17+
"offset",
18+
"order"
19+
]
1120
},
1221
{
1322
"name": "get_entities_by_refs",
1423
"description": "Get multiple entities by their refs.",
15-
"params": ["entityRefs"]
24+
"params": [
25+
"entityRefs"
26+
]
1627
},
1728
{
1829
"name": "get_entities",
1930
"description": "Get all entities in the catalog. Supports pagination and JSON:API formatting for enhanced LLM context.",
20-
"params": ["filter", "fields", "limit", "offset", "format"]
31+
"params": [
32+
"filter",
33+
"fields",
34+
"limit",
35+
"offset",
36+
"format"
37+
]
2138
},
2239
{
2340
"name": "get_entity_ancestors",
2441
"description": "Get the ancestry tree for an entity.",
25-
"params": ["entityRef"]
42+
"params": [
43+
"entityRef"
44+
]
2645
},
2746
{
2847
"name": "get_entity_by_ref",
2948
"description": "Get a single entity by its reference (namespace/name or compound ref).",
30-
"params": ["entityRef"]
49+
"params": [
50+
"entityRef"
51+
]
3152
},
3253
{
3354
"name": "get_entity_facets",
3455
"description": "Get entity facets for a specified field.",
35-
"params": ["filter", "facets"]
56+
"params": [
57+
"filter",
58+
"facets"
59+
]
3660
},
3761
{
3862
"name": "get_location_by_entity",
3963
"description": "Get the location associated with an entity.",
40-
"params": ["entityRef"]
64+
"params": [
65+
"entityRef"
66+
]
4167
},
4268
{
4369
"name": "get_location_by_ref",
4470
"description": "Get location by ref.",
45-
"params": ["locationRef"]
71+
"params": [
72+
"locationRef"
73+
]
4674
},
4775
{
4876
"name": "refresh_entity",
4977
"description": "Trigger a refresh of an entity.",
50-
"params": ["entityRef"]
78+
"params": [
79+
"entityRef"
80+
]
5181
},
5282
{
5383
"name": "remove_entity_by_uid",
5484
"description": "Remove an entity by UID.",
55-
"params": ["uid"]
85+
"params": [
86+
"uid"
87+
]
5688
},
5789
{
5890
"name": "remove_location_by_id",
5991
"description": "Remove a location from the catalog by id.",
60-
"params": ["locationId"]
92+
"params": [
93+
"locationId"
94+
]
6195
},
6296
{
6397
"name": "validate_entity",
6498
"description": "Validate an entity structure.",
65-
"params": ["entity", "locationRef"]
99+
"params": [
100+
"entity",
101+
"locationRef"
102+
]
66103
}
67-
]
104+
]

yarn.lock

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ __metadata:
55
version: 8
66
cacheKey: 10c0
77

8-
"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.27.1":
8+
"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.27.1":
99
version: 7.27.1
1010
resolution: "@babel/code-frame@npm:7.27.1"
1111
dependencies:
@@ -434,6 +434,7 @@ __metadata:
434434
"@rollup/plugin-json": "npm:^6.1.0"
435435
"@rollup/plugin-node-resolve": "npm:^16.0.1"
436436
"@rollup/plugin-replace": "npm:^6.0.2"
437+
"@rollup/plugin-terser": "npm:^0.4.4"
437438
"@rollup/plugin-typescript": "npm:^12.1.4"
438439
"@types/express": "npm:^5.0.3"
439440
"@types/jest": "npm:^30.0.0"
@@ -461,7 +462,6 @@ __metadata:
461462
rollup: "npm:^4.50.2"
462463
rollup-plugin-dts: "npm:^6.2.3"
463464
rollup-plugin-preserve-shebang: "npm:^1.0.1"
464-
rollup-plugin-terser: "npm:^7.0.2"
465465
ts-jest: "npm:^29.4.2"
466466
ts-morph: "npm:^27.0.0"
467467
ts-node: "npm:^10.9.2"
@@ -1426,6 +1426,22 @@ __metadata:
14261426
languageName: node
14271427
linkType: hard
14281428

1429+
"@rollup/plugin-terser@npm:^0.4.4":
1430+
version: 0.4.4
1431+
resolution: "@rollup/plugin-terser@npm:0.4.4"
1432+
dependencies:
1433+
serialize-javascript: "npm:^6.0.1"
1434+
smob: "npm:^1.0.0"
1435+
terser: "npm:^5.17.4"
1436+
peerDependencies:
1437+
rollup: ^2.0.0||^3.0.0||^4.0.0
1438+
peerDependenciesMeta:
1439+
rollup:
1440+
optional: true
1441+
checksum: 10c0/b9cb6c8f02ac1c1344019e9fb854321b74f880efebc41b6bdd84f18331fce0f4a2aadcdb481042245cd3f409b429ac363af71f9efec4a2024731d67d32af36ee
1442+
languageName: node
1443+
linkType: hard
1444+
14291445
"@rollup/plugin-typescript@npm:^12.1.4":
14301446
version: 12.1.4
14311447
resolution: "@rollup/plugin-typescript@npm:12.1.4"
@@ -6031,17 +6047,6 @@ __metadata:
60316047
languageName: node
60326048
linkType: hard
60336049

6034-
"jest-worker@npm:^26.2.1":
6035-
version: 26.6.2
6036-
resolution: "jest-worker@npm:26.6.2"
6037-
dependencies:
6038-
"@types/node": "npm:*"
6039-
merge-stream: "npm:^2.0.0"
6040-
supports-color: "npm:^7.0.0"
6041-
checksum: 10c0/07e4dba650381604cda253ab6d5837fe0279c8d68c25884995b45bfe149a7a1e1b5a97f304b4518f257dac2a9ddc1808d57d650649c3ab855e9e60cf824d2970
6042-
languageName: node
6043-
linkType: hard
6044-
60456050
"jest@npm:^30.1.3":
60466051
version: 30.1.3
60476052
resolution: "jest@npm:30.1.3"
@@ -7862,20 +7867,6 @@ __metadata:
78627867
languageName: node
78637868
linkType: hard
78647869

7865-
"rollup-plugin-terser@npm:^7.0.2":
7866-
version: 7.0.2
7867-
resolution: "rollup-plugin-terser@npm:7.0.2"
7868-
dependencies:
7869-
"@babel/code-frame": "npm:^7.10.4"
7870-
jest-worker: "npm:^26.2.1"
7871-
serialize-javascript: "npm:^4.0.0"
7872-
terser: "npm:^5.0.0"
7873-
peerDependencies:
7874-
rollup: ^2.0.0
7875-
checksum: 10c0/f79b851c6f7b06555d3a8ce7a4e32abd2b7cb8318e89fb8db73e662fa6e3af1a59920e881d111efc65a7437fd9582b61b1f4859b6fd839ba948616829d92432d
7876-
languageName: node
7877-
linkType: hard
7878-
78797870
"rollup@npm:^4.50.2":
78807871
version: 4.50.2
78817872
resolution: "rollup@npm:4.50.2"
@@ -8105,12 +8096,12 @@ __metadata:
81058096
languageName: node
81068097
linkType: hard
81078098

8108-
"serialize-javascript@npm:^4.0.0":
8109-
version: 4.0.0
8110-
resolution: "serialize-javascript@npm:4.0.0"
8099+
"serialize-javascript@npm:^6.0.1":
8100+
version: 6.0.2
8101+
resolution: "serialize-javascript@npm:6.0.2"
81118102
dependencies:
81128103
randombytes: "npm:^2.1.0"
8113-
checksum: 10c0/510dfe7f0311c0b2f7ab06311afa1668ba2969ab2f1faaac0a4924ede76b7f22ba85cfdeaa0052ec5a047bca42c8cd8ac8df8f0efe52f9bd290b3a39ae69fe9d
8104+
checksum: 10c0/2dd09ef4b65a1289ba24a788b1423a035581bef60817bea1f01eda8e3bda623f86357665fe7ac1b50f6d4f583f97db9615b3f07b2a2e8cbcb75033965f771dd2
81148105
languageName: node
81158106
linkType: hard
81168107

@@ -8269,6 +8260,13 @@ __metadata:
82698260
languageName: node
82708261
linkType: hard
82718262

8263+
"smob@npm:^1.0.0":
8264+
version: 1.5.0
8265+
resolution: "smob@npm:1.5.0"
8266+
checksum: 10c0/a1067f23265812de8357ed27312101af49b89129eb973e3f26ab5856ea774f88cace13342e66e32470f933ccfa916e0e9d0f7ca8bbd4f92dfab2af45c15956c2
8267+
languageName: node
8268+
linkType: hard
8269+
82728270
"socks-proxy-agent@npm:^8.0.3":
82738271
version: 8.0.5
82748272
resolution: "socks-proxy-agent@npm:8.0.5"
@@ -8580,7 +8578,7 @@ __metadata:
85808578
languageName: node
85818579
linkType: hard
85828580

8583-
"supports-color@npm:^7.0.0, supports-color@npm:^7.1.0":
8581+
"supports-color@npm:^7.1.0":
85848582
version: 7.2.0
85858583
resolution: "supports-color@npm:7.2.0"
85868584
dependencies:
@@ -8635,7 +8633,7 @@ __metadata:
86358633
languageName: node
86368634
linkType: hard
86378635

8638-
"terser@npm:^5.0.0":
8636+
"terser@npm:^5.17.4":
86398637
version: 5.44.0
86408638
resolution: "terser@npm:5.44.0"
86418639
dependencies:

0 commit comments

Comments
 (0)