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