kitstore-cli 1.0.0 → 1.0.2

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.
Files changed (49) hide show
  1. package/default-config.json +1 -0
  2. package/dist/config.js +20 -4
  3. package/package.json +5 -1
  4. package/.env.test +0 -4
  5. package/.eslintrc.js +0 -29
  6. package/e2e/install.e2e.test.ts +0 -237
  7. package/e2e/integration.e2e.test.ts +0 -346
  8. package/e2e/login.e2e.test.ts +0 -188
  9. package/jest.config.js +0 -24
  10. package/openapitools.json +0 -7
  11. package/src/__tests__/commands/init.test.ts +0 -52
  12. package/src/__tests__/commands/install.test.ts +0 -449
  13. package/src/__tests__/commands/list.test.ts +0 -164
  14. package/src/__tests__/commands/login.test.ts +0 -293
  15. package/src/__tests__/commands/rule-check.test.ts +0 -52
  16. package/src/__tests__/commands/search.test.ts +0 -168
  17. package/src/__tests__/commands/upload.test.ts +0 -404
  18. package/src/__tests__/config.test.ts +0 -181
  19. package/src/__tests__/setup.ts +0 -11
  20. package/src/api/client.ts +0 -20
  21. package/src/api/generated/.openapi-generator/FILES +0 -17
  22. package/src/api/generated/.openapi-generator/VERSION +0 -1
  23. package/src/api/generated/.openapi-generator-ignore +0 -23
  24. package/src/api/generated/api.ts +0 -1171
  25. package/src/api/generated/base.ts +0 -62
  26. package/src/api/generated/common.ts +0 -113
  27. package/src/api/generated/configuration.ts +0 -121
  28. package/src/api/generated/docs/AuthApi.md +0 -158
  29. package/src/api/generated/docs/AuthResponseDto.md +0 -22
  30. package/src/api/generated/docs/AuthUserDto.md +0 -24
  31. package/src/api/generated/docs/HealthApi.md +0 -183
  32. package/src/api/generated/docs/LoginDto.md +0 -22
  33. package/src/api/generated/docs/RegisterDto.md +0 -24
  34. package/src/api/generated/docs/RuleAuthorDto.md +0 -22
  35. package/src/api/generated/docs/RuleResponseDto.md +0 -36
  36. package/src/api/generated/docs/RulesApi.md +0 -289
  37. package/src/api/generated/git_push.sh +0 -57
  38. package/src/api/generated/index.ts +0 -18
  39. package/src/commands/init.ts +0 -46
  40. package/src/commands/install.ts +0 -129
  41. package/src/commands/list.ts +0 -71
  42. package/src/commands/login.ts +0 -65
  43. package/src/commands/rule-check.ts +0 -49
  44. package/src/commands/search.ts +0 -66
  45. package/src/commands/upload.ts +0 -117
  46. package/src/config.ts +0 -66
  47. package/src/index.ts +0 -79
  48. package/test-cli-config.js +0 -118
  49. package/tsconfig.json +0 -24
@@ -1,188 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { existsSync, unlinkSync, readFileSync } from 'fs';
3
- import * as path from 'path';
4
-
5
- // TC-E2E-CLI-001: Complete login flow
6
- // TC-E2E-CLI-009: Error handling (auth error)
7
- // TC-E2E-CLI-010: Interactive login flow
8
- describe('CLI Login E2E Tests', () => {
9
- const tempHome = path.join(process.cwd(), 'temp-home-login');
10
- const configDir = path.join(tempHome, '.kitstore');
11
- const configPath = path.join(configDir, 'config.json');
12
- const cliPath = path.join(process.cwd(), 'dist', 'index.js');
13
-
14
- beforeAll(() => {
15
- if (!existsSync(tempHome)) {
16
- require('fs').mkdirSync(tempHome, { recursive: true });
17
- }
18
- });
19
-
20
- beforeEach(() => {
21
- // Clean up config file
22
- if (existsSync(configPath)) {
23
- unlinkSync(configPath);
24
- }
25
- });
26
-
27
- afterAll(() => {
28
- // Clean up temp home
29
- if (existsSync(tempHome)) {
30
- require('fs-extra').removeSync(tempHome);
31
- }
32
- });
33
-
34
- afterEach(() => {
35
- // Clean up after tests
36
- if (existsSync(configPath)) {
37
- unlinkSync(configPath);
38
- }
39
- });
40
-
41
- // TC-E2E-CLI-001: Complete login flow
42
- test('should login successfully and save token', () => {
43
- // Skip if CLI is not built
44
- if (!existsSync(cliPath)) {
45
- console.warn('Skipping test: CLI not built');
46
- return;
47
- }
48
-
49
- try {
50
- // Run login command with test credentials
51
- const result = execSync(
52
- `node ${cliPath} login --email test@example.com --password testpassword123`,
53
- {
54
- encoding: 'utf8',
55
- timeout: 10000,
56
- env: {
57
- ...process.env,
58
- NODE_ENV: 'test',
59
- AGENTKIT_CONFIG_DIR: configDir,
60
- HOME: tempHome,
61
- USERPROFILE: tempHome,
62
- HOMEDRIVE: tempHome.substring(0, 2),
63
- HOMEPATH: tempHome.substring(2)
64
- }
65
- }
66
- );
67
-
68
- // Check if login was successful
69
- expect(result).toContain('✅ Logged in');
70
-
71
- // Check if config file was created
72
- expect(existsSync(configPath)).toBe(true);
73
-
74
- // Verify config contains token
75
- const config = JSON.parse(readFileSync(configPath, 'utf8'));
76
- expect(config.token).toBeDefined();
77
- expect(config.user).toBeDefined();
78
- expect(config.user.username).toBe('testuser');
79
-
80
- } catch (error: any) {
81
- const output = (error.stdout || '') + (error.stderr || '');
82
- if (
83
- output.includes('ECONNREFUSED') ||
84
- output.includes('ENOTFOUND') ||
85
- output.includes('Login failed: Error') ||
86
- output.includes('Unauthorized') ||
87
- output.includes('status code 401')
88
- ) {
89
- console.warn('Skipping test: Backend server not running or unauthorized');
90
- return;
91
- } else {
92
- throw error;
93
- }
94
- }
95
- });
96
-
97
- // TC-E2E-CLI-009: Error handling (auth error)
98
- test('should handle authentication error', () => {
99
- // Skip if CLI is not built
100
- if (!existsSync(cliPath)) {
101
- console.warn('Skipping test: CLI not built');
102
- return;
103
- }
104
-
105
- try {
106
- // Run login command with invalid credentials
107
- execSync(
108
- `node ${cliPath} login --email invalid@example.com --password wrongpassword`,
109
- {
110
- encoding: 'utf8',
111
- timeout: 10000,
112
- env: {
113
- ...process.env,
114
- NODE_ENV: 'test',
115
- AGENTKIT_CONFIG_DIR: configDir,
116
- HOME: tempHome,
117
- USERPROFILE: tempHome,
118
- HOMEDRIVE: tempHome.substring(0, 2),
119
- HOMEPATH: tempHome.substring(2)
120
- }
121
- }
122
- );
123
-
124
- // Should not reach here - command should exit with error
125
- fail('Expected login command to fail with invalid credentials');
126
- } catch (error: any) {
127
- // Expected to fail
128
- expect(error.status).toBe(1);
129
- expect(error.stderr || error.stdout).toContain('❌ Login failed');
130
-
131
- // Config file should not be created
132
- expect(existsSync(configPath)).toBe(false);
133
- }
134
- });
135
-
136
- // TC-E2E-CLI-010: Login with custom server
137
- test('should login with custom server URL', () => {
138
- // Skip if CLI is not built
139
- if (!existsSync(cliPath)) {
140
- console.warn('Skipping test: CLI not built');
141
- return;
142
- }
143
-
144
- try {
145
- // Run login command with custom server
146
- const result = execSync(
147
- `node ${cliPath} login --email test@example.com --password testpassword123 --server http://localhost:3000`,
148
- {
149
- encoding: 'utf8',
150
- timeout: 10000,
151
- env: {
152
- ...process.env,
153
- NODE_ENV: 'test',
154
- AGENTKIT_CONFIG_DIR: configDir,
155
- HOME: tempHome,
156
- USERPROFILE: tempHome,
157
- HOMEDRIVE: tempHome.substring(0, 2),
158
- HOMEPATH: tempHome.substring(2)
159
- }
160
- }
161
- );
162
-
163
- expect(result).toContain('✅ Logged in');
164
-
165
- // Verify config contains custom server
166
- const config = JSON.parse(readFileSync(configPath, 'utf8'));
167
- expect(config.server).toBe('http://localhost:3000');
168
-
169
- } catch (error: any) {
170
- const output = (error.stdout || '') + (error.stderr || '');
171
- if (
172
- output.includes('ECONNREFUSED') ||
173
- output.includes('ENOTFOUND') ||
174
- output.includes('Login failed: Error') ||
175
- output.includes('Unauthorized') ||
176
- output.includes('status code 401')
177
- ) {
178
- console.warn('Skipping test: Backend server not running or unauthorized');
179
- return;
180
- } else {
181
- throw error;
182
- }
183
- }
184
- });
185
- });
186
-
187
-
188
-
package/jest.config.js DELETED
@@ -1,24 +0,0 @@
1
- module.exports = {
2
- preset: 'ts-jest',
3
- testEnvironment: 'node',
4
- roots: ['<rootDir>/src', '<rootDir>/e2e'],
5
- testMatch: ['**/__tests__/**/*.test.ts', '**/*.e2e.test.ts'],
6
- collectCoverageFrom: [
7
- 'src/**/*.ts',
8
- '!src/**/*.d.ts',
9
- '!src/index.ts',
10
- '!src/api/generated/**',
11
- ],
12
- coverageDirectory: 'coverage',
13
- moduleNameMapper: {
14
- '^@/(.*)$': '<rootDir>/src/$1',
15
- },
16
- transform: {
17
- '^.+\\.ts$': ['ts-jest', {
18
- useESM: false,
19
- }],
20
- },
21
- extensionsToTreatAsEsm: [],
22
- setupFilesAfterEnv: ['<rootDir>/src/__tests__/setup.ts'],
23
- };
24
-
package/openapitools.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
3
- "spaces": 2,
4
- "generator-cli": {
5
- "version": "7.17.0"
6
- }
7
- }
@@ -1,52 +0,0 @@
1
- import { initCommand } from '../../commands/init';
2
- import * as fs from 'fs-extra';
3
- import * as path from 'path';
4
- import inquirer from 'inquirer';
5
- import chalk from 'chalk';
6
-
7
- jest.mock('fs-extra');
8
- jest.mock('inquirer');
9
-
10
- describe('Init Command', () => {
11
- const cwd = process.cwd();
12
- const cursorDir = path.join(cwd, '.cursor');
13
-
14
- beforeEach(() => {
15
- jest.clearAllMocks();
16
- jest.spyOn(console, 'log').mockImplementation();
17
- jest.spyOn(console, 'error').mockImplementation();
18
- });
19
-
20
- it('should initialize cursor kit directories', async () => {
21
- (fs.pathExists as unknown as jest.Mock).mockResolvedValue(false);
22
- (fs.ensureDir as unknown as jest.Mock).mockResolvedValue(undefined);
23
-
24
- await initCommand();
25
-
26
- expect(fs.ensureDir).toHaveBeenCalledWith(path.join(cursorDir, 'rules'));
27
- expect(fs.ensureDir).toHaveBeenCalledWith(path.join(cursorDir, 'commands'));
28
- expect(console.log).toHaveBeenCalledWith(expect.stringContaining('Successfully initialized Cursor Kit!'));
29
- });
30
-
31
- it('should ask for confirmation if .cursor exists', async () => {
32
- (fs.pathExists as unknown as jest.Mock).mockResolvedValue(true);
33
- (inquirer.prompt as unknown as jest.Mock).mockResolvedValue({ overwrite: true });
34
- (fs.ensureDir as unknown as jest.Mock).mockResolvedValue(undefined);
35
-
36
- await initCommand();
37
-
38
- expect(inquirer.prompt).toHaveBeenCalled();
39
- expect(fs.ensureDir).toHaveBeenCalled();
40
- });
41
-
42
- it('should cancel if user chooses not to overwrite', async () => {
43
- (fs.pathExists as unknown as jest.Mock).mockResolvedValue(true);
44
- (inquirer.prompt as unknown as jest.Mock).mockResolvedValue({ overwrite: false });
45
-
46
- await initCommand();
47
-
48
- expect(console.log).toHaveBeenCalledWith(expect.stringContaining('Initialization cancelled.'));
49
- expect(fs.ensureDir).not.toHaveBeenCalled();
50
- });
51
- });
52
-