@l4yercak3/cli 1.1.6 → 1.1.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.
@@ -15,7 +15,9 @@
15
15
  "Bash(npm whoami:*)",
16
16
  "Bash(npm pkg fix:*)",
17
17
  "Bash(git push:*)",
18
- "Bash(session\" errors when trying to use features.\n\nNow the login command validates the session with the backend first.\nIf validation fails, it clears the local session and prompts for\nfresh login, avoiding the confusing loop.\n\nšŸ¤– Generated with [Claude Code]\\(https://claude.com/claude-code\\)\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")"
18
+ "Bash(session\" errors when trying to use features.\n\nNow the login command validates the session with the backend first.\nIf validation fails, it clears the local session and prompts for\nfresh login, avoiding the confusing loop.\n\nšŸ¤– Generated with [Claude Code]\\(https://claude.com/claude-code\\)\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
19
+ "Bash(npm run build:*)",
20
+ "Bash(npm version:*)"
19
21
  ]
20
22
  }
21
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@l4yercak3/cli",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Icing on the L4yercak3 - The sweet finishing touch for your Layer Cake integration",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -49,19 +49,43 @@ class BackendClient {
49
49
  */
50
50
  async request(method, endpoint, data = null) {
51
51
  const url = `${this.baseUrl}${endpoint}`;
52
+ const headers = this.getHeaders();
52
53
  const options = {
53
54
  method,
54
- headers: this.getHeaders(),
55
+ headers,
55
56
  };
56
57
 
57
58
  if (data && (method === 'POST' || method === 'PUT' || method === 'PATCH')) {
58
59
  options.body = JSON.stringify(data);
59
60
  }
60
61
 
62
+ // Debug logging - enable with L4YERCAK3_DEBUG=1
63
+ if (process.env.L4YERCAK3_DEBUG) {
64
+ console.log('\n[DEBUG] API Request:');
65
+ console.log(` URL: ${url}`);
66
+ console.log(` Method: ${method}`);
67
+ console.log(` Headers: ${JSON.stringify(headers, null, 2)}`);
68
+ if (options.body) {
69
+ console.log(` Body: ${options.body}`);
70
+ }
71
+ }
72
+
61
73
  try {
62
74
  const response = await fetch(url, options);
75
+
76
+ // Debug: log raw response info
77
+ if (process.env.L4YERCAK3_DEBUG) {
78
+ console.log('[DEBUG] API Response:');
79
+ console.log(` Status: ${response.status} ${response.statusText}`);
80
+ console.log(` Headers: ${JSON.stringify(Object.fromEntries(response.headers.entries()), null, 2)}`);
81
+ }
82
+
63
83
  const responseData = await response.json();
64
84
 
85
+ if (process.env.L4YERCAK3_DEBUG) {
86
+ console.log(` Body: ${JSON.stringify(responseData, null, 2)}\n`);
87
+ }
88
+
65
89
  if (!response.ok) {
66
90
  // Create error with additional details from backend
67
91
  const error = new Error(responseData.message || responseData.error || `API request failed: ${response.status}`);
@@ -75,6 +99,9 @@ class BackendClient {
75
99
 
76
100
  return responseData;
77
101
  } catch (error) {
102
+ if (process.env.L4YERCAK3_DEBUG) {
103
+ console.log(`[DEBUG] Request error: ${error.message}`);
104
+ }
78
105
  if (error.message.includes('fetch')) {
79
106
  throw new Error(`Network error: Could not connect to backend at ${this.baseUrl}`);
80
107
  }