@kenhkl/agent-moss 0.15.0 → 0.15.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.
package/dist/server.js CHANGED
@@ -160,8 +160,12 @@ function resolveConfigPath() {
160
160
  if (envPath) return envPath;
161
161
  const userConfig = path2.join(getConfigDir(), "config.json");
162
162
  if (fs.existsSync(userConfig)) return userConfig;
163
- const defaultConfig = path2.join(__dirname, "..", "..", "agent_moss", "infra", "config.json.example");
164
- if (fs.existsSync(defaultConfig)) {
163
+ const defaultCandidates = [
164
+ path2.join(__dirname, "config.json.example"),
165
+ path2.join(__dirname, "..", "..", "agent_moss", "infra", "config.json.example")
166
+ ];
167
+ const defaultConfig = defaultCandidates.find((p) => fs.existsSync(p));
168
+ if (defaultConfig) {
165
169
  const configDir = path2.dirname(userConfig);
166
170
  fs.mkdirSync(configDir, { recursive: true });
167
171
  const pkgConfig = loadConfigFile(defaultConfig);
@@ -3186,7 +3190,7 @@ function isArchiveReadOfDir(command, dirPath) {
3186
3190
  }
3187
3191
  if (fw === "cp" || fw === "rsync") {
3188
3192
  const segPaths = s.match(/[/~][^\s;|&><'"]*/g) || [];
3189
- if (segPaths.length && segPaths[0].includes(dpath)) return true;
3193
+ if (segPaths[0]?.includes(dpath)) return true;
3190
3194
  }
3191
3195
  }
3192
3196
  return false;