kitstore-cli 1.0.38 → 1.0.40

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.
@@ -151,7 +151,7 @@ describe('Login Command', () => {
151
151
  password: 'WrongPassword',
152
152
  })).rejects.toThrow();
153
153
  expect(mockSaveConfig).not.toHaveBeenCalled();
154
- expect(console.error).toHaveBeenCalledWith('❌ Login failed: Invalid credentials');
154
+ expect(console.error).toHaveBeenCalledWith('❌ Login failed: Invalid email or password');
155
155
  });
156
156
  // TC-UNIT-CLI-003: Interactive login prompts
157
157
  it('should prompt for email and password when not provided', async () => {
@@ -12,9 +12,9 @@ const client_1 = require("../api/client");
12
12
  * @requirement TC-UNIT-CLI-001, TC-UNIT-CLI-002, TC-E2E-CLI-001
13
13
  */
14
14
  async function loginCommand(options) {
15
+ const config = await (0, config_1.getConfig)();
16
+ const server = options.server || config.server;
15
17
  try {
16
- const config = await (0, config_1.getConfig)();
17
- const server = options.server || config.server;
18
18
  let email = options.email;
19
19
  let password = options.password;
20
20
  if (!email) {
@@ -52,15 +52,44 @@ async function loginCommand(options) {
52
52
  }
53
53
  }
54
54
  catch (err) {
55
+ let errorMessage = 'Unknown error';
55
56
  if (axios_1.default.isAxiosError(err)) {
56
- console.error(`❌ Login failed: ${err.response?.data?.message?.message || err.response?.data?.message || err.message}`);
57
+ // Handle Axios errors (network, HTTP errors)
58
+ const status = err.response?.status;
59
+ const message = err.response?.data?.message?.message ||
60
+ err.response?.data?.message ||
61
+ err.message;
62
+ if (status === 401) {
63
+ errorMessage = 'Invalid email or password';
64
+ }
65
+ else if (status === 429) {
66
+ errorMessage = 'Rate limit exceeded. Please try again later';
67
+ }
68
+ else if (err.code === 'ECONNREFUSED') {
69
+ errorMessage = `Cannot connect to server at ${err.config?.url || server}. Is the server running?`;
70
+ }
71
+ else if (err.code === 'ENOTFOUND') {
72
+ errorMessage = `Server not found: ${err.config?.url || server}. Check your server URL.`;
73
+ }
74
+ else if (err.code === 'ETIMEDOUT' || err.code === 'ECONNABORTED') {
75
+ errorMessage = `Connection timeout. Server at ${err.config?.url || server} did not respond in time.`;
76
+ }
77
+ else {
78
+ errorMessage = message || `HTTP ${status || 'error'}`;
79
+ }
57
80
  }
58
81
  else if (err instanceof Error) {
59
- console.error(`❌ Login failed: ${err.message}`);
82
+ errorMessage = err.message;
60
83
  }
61
- else {
62
- console.error(`❌ Login failed: ${err}`);
84
+ else if (typeof err === 'string') {
85
+ errorMessage = err;
86
+ }
87
+ else if (err && typeof err === 'object') {
88
+ // Try to extract meaningful information from object
89
+ const errObj = err;
90
+ errorMessage = errObj.message || errObj.error || errObj.toString() || 'Unknown error occurred';
63
91
  }
92
+ console.error(`❌ Login failed: ${errorMessage}`);
64
93
  process.exit(1);
65
94
  }
66
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitstore-cli",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "CLI tool for Cursor Kit",
5
5
  "main": "dist/index.js",
6
6
  "bin": {