@codebakers/cli 1.0.2 → 1.0.3

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 (2) hide show
  1. package/dist/index.js +4 -2
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -19,6 +19,8 @@ import { existsSync } from "fs";
19
19
  import { join } from "path";
20
20
 
21
21
  // src/utils/api.ts
22
+ import nodeFetch from "node-fetch";
23
+ var fetchFn = typeof fetch !== "undefined" ? fetch : nodeFetch;
22
24
  var ApiError = class extends Error {
23
25
  constructor(message, statusCode, code) {
24
26
  super(message);
@@ -34,7 +36,7 @@ async function makeRequest(endpoint, options = {}) {
34
36
  }
35
37
  const baseUrl = getApiUrl();
36
38
  const url = `${baseUrl}${endpoint}`;
37
- const response = await fetch(url, {
39
+ const response = await fetchFn(url, {
38
40
  ...options,
39
41
  headers: {
40
42
  "Content-Type": "application/json",
@@ -55,7 +57,7 @@ async function makeRequest(endpoint, options = {}) {
55
57
  async function validateApiKey(apiKey) {
56
58
  const baseUrl = getApiUrl();
57
59
  try {
58
- const response = await fetch(`${baseUrl}/api/patterns`, {
60
+ const response = await fetchFn(`${baseUrl}/api/patterns`, {
59
61
  headers: {
60
62
  Authorization: `Bearer ${apiKey}`
61
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebakers/cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "CodeBakers CLI - AI prompt patterns for production-ready code",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -40,6 +40,7 @@
40
40
  "commander": "^12.1.0",
41
41
  "conf": "^12.0.0",
42
42
  "inquirer": "^9.2.23",
43
+ "node-fetch": "^3.3.2",
43
44
  "ora": "^8.0.1"
44
45
  },
45
46
  "devDependencies": {