kitstore-cli 1.0.92 → 1.0.93

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/config.js +21 -19
  2. package/package.json +1 -1
package/dist/config.js CHANGED
@@ -59,11 +59,28 @@ async function loadBundledDefaultConfig() {
59
59
  return defaultConfig;
60
60
  }
61
61
  }
62
- // Strategy 2: Use require.resolve to find the current module, then resolve config relative to it
62
+ // Strategy 2: Try require.resolve for package.json first (works when package is in node_modules or npx cache)
63
+ // This is more reliable than resolving './config' because it finds the package root directly
64
+ try {
65
+ const packageJsonPath = require.resolve('kitstore-cli/package.json');
66
+ const packageDir = path.dirname(packageJsonPath);
67
+ const defaultConfigPath = path.join(packageDir, 'default-config.json');
68
+ if (await fs.pathExists(defaultConfigPath)) {
69
+ const defaultConfig = await fs.readJson(defaultConfigPath);
70
+ if (defaultConfig && typeof defaultConfig === 'object' && defaultConfig.server) {
71
+ return defaultConfig;
72
+ }
73
+ }
74
+ }
75
+ catch (err) {
76
+ // Strategy 2 failed, try Strategy 3
77
+ }
78
+ // Strategy 3: Use require.resolve to find the current module, then resolve config relative to it
63
79
  // This works when the package is installed via npm and we can resolve our own module
64
80
  try {
65
81
  // Resolve the current module (config.js) to get its location
66
- const currentModulePath = require.resolve('./config');
82
+ // Use the full path from the package to be more reliable
83
+ const currentModulePath = require.resolve('kitstore-cli/dist/config');
67
84
  const currentModuleDir = path.dirname(currentModulePath);
68
85
  // Go up to package root (from dist/ to package root)
69
86
  const packageRoot = path.dirname(currentModuleDir);
@@ -76,9 +93,9 @@ async function loadBundledDefaultConfig() {
76
93
  }
77
94
  }
78
95
  catch (err) {
79
- // Strategy 2 failed, try Strategy 3
96
+ // Strategy 3 failed, try Strategy 4
80
97
  }
81
- // Strategy 3: Try to find default-config.json in process.cwd()/node_modules/kitstore-cli/
98
+ // Strategy 4: Try to find default-config.json in process.cwd()/node_modules/kitstore-cli/
82
99
  // This works when running from a project that has kitstore-cli installed locally
83
100
  try {
84
101
  const nodeModulesPath = path.join(process.cwd(), 'node_modules', 'kitstore-cli', 'default-config.json');
@@ -89,21 +106,6 @@ async function loadBundledDefaultConfig() {
89
106
  }
90
107
  }
91
108
  }
92
- catch (err) {
93
- // Strategy 3 failed, continue
94
- }
95
- // Strategy 4: Try require.resolve for package.json (works when package is in node_modules)
96
- try {
97
- const packageJsonPath = require.resolve('kitstore-cli/package.json');
98
- const packageDir = path.dirname(packageJsonPath);
99
- const defaultConfigPath = path.join(packageDir, 'default-config.json');
100
- if (await fs.pathExists(defaultConfigPath)) {
101
- const defaultConfig = await fs.readJson(defaultConfigPath);
102
- if (defaultConfig && typeof defaultConfig === 'object' && defaultConfig.server) {
103
- return defaultConfig;
104
- }
105
- }
106
- }
107
109
  catch (err) {
108
110
  // Strategy 4 failed, continue
109
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitstore-cli",
3
- "version": "1.0.92",
3
+ "version": "1.0.93",
4
4
  "description": "CLI tool for Cursor Kit",
5
5
  "main": "dist/index.js",
6
6
  "bin": {