kitstore-cli 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/commands/install.test.js +14 -2
- package/dist/__tests__/commands/list.test.js +14 -6
- package/dist/__tests__/commands/search.test.js +14 -8
- package/dist/commands/install.js +9 -6
- package/dist/commands/list.js +10 -10
- package/dist/commands/search.js +10 -10
- package/package.json +1 -1
|
@@ -172,7 +172,13 @@ describe('Install Command', () => {
|
|
|
172
172
|
mockFsEnsureDir.mockResolvedValue(undefined);
|
|
173
173
|
mockFsWriteFile.mockResolvedValue(undefined);
|
|
174
174
|
await (0, install_1.installCommand)({ tag: 'test' });
|
|
175
|
-
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(
|
|
175
|
+
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(undefined, // page
|
|
176
|
+
undefined, // limit
|
|
177
|
+
'test', // tag
|
|
178
|
+
undefined, // name
|
|
179
|
+
undefined, // type
|
|
180
|
+
undefined // authorId
|
|
181
|
+
);
|
|
176
182
|
});
|
|
177
183
|
// TC-UNIT-CLI-027: Install with type filtering
|
|
178
184
|
it('should filter rules by type', async () => {
|
|
@@ -212,7 +218,13 @@ describe('Install Command', () => {
|
|
|
212
218
|
mockFsEnsureDir.mockResolvedValue(undefined);
|
|
213
219
|
mockFsWriteFile.mockResolvedValue(undefined);
|
|
214
220
|
await (0, install_1.installCommand)({ type: 'rule' });
|
|
215
|
-
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(
|
|
221
|
+
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(undefined, // page
|
|
222
|
+
undefined, // limit
|
|
223
|
+
undefined, // tag
|
|
224
|
+
undefined, // name
|
|
225
|
+
'rule', // type
|
|
226
|
+
undefined // authorId
|
|
227
|
+
);
|
|
216
228
|
});
|
|
217
229
|
// TC-UNIT-CLI-028: Install with file download failure
|
|
218
230
|
it('should handle file download failure', async () => {
|
|
@@ -94,7 +94,13 @@ describe('List Command', () => {
|
|
|
94
94
|
mockCreateApi.mockResolvedValue({ rulesApi: mockRulesApi });
|
|
95
95
|
await (0, list_1.listCommand)({});
|
|
96
96
|
expect(mockCreateApi).toHaveBeenCalledWith({ server: 'http://localhost:3000' });
|
|
97
|
-
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(
|
|
97
|
+
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(undefined, // page
|
|
98
|
+
undefined, // limit
|
|
99
|
+
undefined, // tag
|
|
100
|
+
undefined, // name
|
|
101
|
+
undefined, // type
|
|
102
|
+
undefined // authorId
|
|
103
|
+
);
|
|
98
104
|
expect(console.log).toHaveBeenCalledWith(expect.stringContaining('📋 Found 2 rules/commands:'));
|
|
99
105
|
});
|
|
100
106
|
it('should apply filters when provided', async () => {
|
|
@@ -122,11 +128,13 @@ describe('List Command', () => {
|
|
|
122
128
|
};
|
|
123
129
|
mockCreateApi.mockResolvedValue({ rulesApi: mockRulesApi });
|
|
124
130
|
await (0, list_1.listCommand)({ type: 'rule', tag: 'test', limit: '10' });
|
|
125
|
-
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(undefined, // page
|
|
132
|
+
10, // limit
|
|
133
|
+
'test', // tag
|
|
134
|
+
undefined, // name
|
|
135
|
+
'rule', // type
|
|
136
|
+
undefined // authorId
|
|
137
|
+
);
|
|
130
138
|
});
|
|
131
139
|
it('should handle empty results', async () => {
|
|
132
140
|
mockGetConfig.mockResolvedValue({
|
|
@@ -84,9 +84,13 @@ describe('Search Command', () => {
|
|
|
84
84
|
mockCreateApi.mockResolvedValue({ rulesApi: mockRulesApi });
|
|
85
85
|
await (0, search_1.searchCommand)('auth', {});
|
|
86
86
|
expect(mockCreateApi).toHaveBeenCalledWith({ server: 'http://localhost:3000' });
|
|
87
|
-
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(undefined, // page
|
|
88
|
+
undefined, // limit
|
|
89
|
+
undefined, // tag
|
|
90
|
+
'auth', // name (search query)
|
|
91
|
+
undefined, // type
|
|
92
|
+
undefined // authorId
|
|
93
|
+
);
|
|
90
94
|
expect(console.log).toHaveBeenCalledWith('🔍 Search results for "auth":');
|
|
91
95
|
});
|
|
92
96
|
it('should apply additional filters with search query', async () => {
|
|
@@ -114,11 +118,13 @@ describe('Search Command', () => {
|
|
|
114
118
|
};
|
|
115
119
|
mockCreateApi.mockResolvedValue({ rulesApi: mockRulesApi });
|
|
116
120
|
await (0, search_1.searchCommand)('validation', { type: 'rule', limit: '5' });
|
|
117
|
-
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
expect(mockRulesApi.rulesControllerFindAll).toHaveBeenCalledWith(undefined, // page
|
|
122
|
+
5, // limit
|
|
123
|
+
undefined, // tag
|
|
124
|
+
'validation', // name (search query)
|
|
125
|
+
'rule', // type
|
|
126
|
+
undefined // authorId
|
|
127
|
+
);
|
|
122
128
|
});
|
|
123
129
|
it('should handle no search results', async () => {
|
|
124
130
|
mockGetConfig.mockResolvedValue({
|
package/dist/commands/install.js
CHANGED
|
@@ -54,12 +54,15 @@ async function installCommand(options) {
|
|
|
54
54
|
process.exit(1);
|
|
55
55
|
}
|
|
56
56
|
const { rulesApi } = await (0, client_1.createApi)();
|
|
57
|
-
// Query rules
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
// Query rules - pass parameters individually to match API client signature
|
|
58
|
+
// API expects: (page?: number, limit?: number, tag?: string, name?: string, type?: string, authorId?: string)
|
|
59
|
+
const response = await rulesApi.rulesControllerFindAll(undefined, // page (use default)
|
|
60
|
+
undefined, // limit (use default)
|
|
61
|
+
options.tag, // tag
|
|
62
|
+
options.name, // name
|
|
63
|
+
options.type, // type
|
|
64
|
+
undefined // authorId
|
|
65
|
+
);
|
|
63
66
|
const rules = response.data;
|
|
64
67
|
if (!rules || rules.length === 0) {
|
|
65
68
|
console.log('📭 No rules found matching the criteria.');
|
package/dist/commands/list.js
CHANGED
|
@@ -19,16 +19,16 @@ async function listCommand(options) {
|
|
|
19
19
|
process.exit(1);
|
|
20
20
|
}
|
|
21
21
|
const { rulesApi } = await (0, client_1.createApi)({ server: config.server });
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
// Pass parameters individually to match API client signature
|
|
23
|
+
// API expects: (page?: number, limit?: number, tag?: string, name?: string, type?: string, authorId?: string)
|
|
24
|
+
const limit = options.limit ? parseInt(options.limit) : undefined;
|
|
25
|
+
const response = await rulesApi.rulesControllerFindAll(undefined, // page (use default)
|
|
26
|
+
limit, // limit
|
|
27
|
+
options.tag, // tag
|
|
28
|
+
options.name, // name
|
|
29
|
+
options.type, // type
|
|
30
|
+
undefined // authorId
|
|
31
|
+
);
|
|
32
32
|
if (response.data && response.data.length > 0) {
|
|
33
33
|
console.log(chalk_1.default.blue(`📋 Found ${response.data.length} rules/commands:`));
|
|
34
34
|
console.log('');
|
package/dist/commands/search.js
CHANGED
|
@@ -15,16 +15,16 @@ async function searchCommand(query, options) {
|
|
|
15
15
|
process.exit(1);
|
|
16
16
|
}
|
|
17
17
|
const { rulesApi } = await (0, client_1.createApi)({ server: config.server });
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
// Pass parameters individually to match API client signature
|
|
19
|
+
// API expects: (page?: number, limit?: number, tag?: string, name?: string, type?: string, authorId?: string)
|
|
20
|
+
const limit = options.limit ? parseInt(options.limit) : undefined;
|
|
21
|
+
const response = await rulesApi.rulesControllerFindAll(undefined, // page (use default)
|
|
22
|
+
limit, // limit
|
|
23
|
+
options.tag, // tag
|
|
24
|
+
query, // name (search query)
|
|
25
|
+
options.type, // type
|
|
26
|
+
undefined // authorId
|
|
27
|
+
);
|
|
28
28
|
if (response.data && response.data.length > 0) {
|
|
29
29
|
console.log(`🔍 Search results for "${query}":`);
|
|
30
30
|
console.log(`📋 Found ${response.data.length} matching rules/commands:`);
|