locus-product-planning 1.2.5 → 1.2.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.
package/dist/index.cjs CHANGED
@@ -12484,6 +12484,28 @@ function safeString(value) {
12484
12484
  }
12485
12485
  return null;
12486
12486
  }
12487
+ function safeJoin(...paths) {
12488
+ const stringPaths = [];
12489
+ for (const p of paths) {
12490
+ if (typeof p === "string") {
12491
+ stringPaths.push(p);
12492
+ } else if (p != null) {
12493
+ const str = String(p);
12494
+ if (str && str !== "[object Object]" && str !== "undefined" && str !== "null") {
12495
+ stringPaths.push(str);
12496
+ }
12497
+ }
12498
+ }
12499
+ if (stringPaths.length === 0) {
12500
+ return ".";
12501
+ }
12502
+ try {
12503
+ return (0, import_path.join)(...stringPaths);
12504
+ } catch {
12505
+ const sep = stringPaths[0].includes("\\") ? "\\" : "/";
12506
+ return stringPaths.join(sep).replace(/[\/\\]+/g, sep);
12507
+ }
12508
+ }
12487
12509
  function getCurrentDirname() {
12488
12510
  if (typeof _cachedDirname === "string" && _cachedDirname.length > 0) {
12489
12511
  return _cachedDirname;
@@ -12511,7 +12533,7 @@ function getCurrentDirname() {
12511
12533
  try {
12512
12534
  const packageJsonPath = safeString(require.resolve("locus-product-planning/package.json"));
12513
12535
  if (packageJsonPath) {
12514
- const result = safeString((0, import_path.join)((0, import_path.dirname)(packageJsonPath), "dist"));
12536
+ const result = safeString(safeJoin((0, import_path.dirname)(packageJsonPath), "dist"));
12515
12537
  if (result) {
12516
12538
  _cachedDirname = result;
12517
12539
  return result;
@@ -12522,8 +12544,8 @@ function getCurrentDirname() {
12522
12544
  const homeDir = safeString(process.env.USERPROFILE) || safeString(process.env.HOME);
12523
12545
  if (homeDir) {
12524
12546
  const cacheLocations = [
12525
- (0, import_path.join)(homeDir, ".cache", "opencode", "node_modules", "locus-product-planning", "dist"),
12526
- (0, import_path.join)(homeDir, ".config", "opencode", "node_modules", "locus-product-planning", "dist")
12547
+ safeJoin(homeDir, ".cache", "opencode", "node_modules", "locus-product-planning", "dist"),
12548
+ safeJoin(homeDir, ".config", "opencode", "node_modules", "locus-product-planning", "dist")
12527
12549
  ];
12528
12550
  for (const loc of cacheLocations) {
12529
12551
  try {
@@ -12709,9 +12731,9 @@ function findSkillsInDir(dir, sourceType, maxDepth = 4) {
12709
12731
  }
12710
12732
  for (const entry of entries) {
12711
12733
  if (entry.name.startsWith(".")) continue;
12712
- const fullPath = (0, import_path.join)(currentDir, entry.name);
12734
+ const fullPath = safeJoin(currentDir, entry.name);
12713
12735
  if (entry.isDirectory()) {
12714
- const skillFile = (0, import_path.join)(fullPath, "SKILL.md");
12736
+ const skillFile = safeJoin(fullPath, "SKILL.md");
12715
12737
  if ((0, import_fs.existsSync)(skillFile)) {
12716
12738
  const meta = extractFrontmatter(skillFile);
12717
12739
  skills.push({
@@ -12746,7 +12768,7 @@ function findAgentsInDir(dir, maxDepth = 3) {
12746
12768
  }
12747
12769
  for (const entry of entries) {
12748
12770
  if (entry.name.startsWith(".")) continue;
12749
- const fullPath = (0, import_path.join)(currentDir, entry.name);
12771
+ const fullPath = safeJoin(currentDir, entry.name);
12750
12772
  if (entry.isDirectory()) {
12751
12773
  recurse(fullPath, depth + 1, entry.name);
12752
12774
  } else if (entry.name.endsWith(".md")) {
@@ -12783,8 +12805,8 @@ function resolveSkillPath(skillName, locusSkillsDir, personalSkillsDir, projectS
12783
12805
  }
12784
12806
  function findSkillByName(baseDir, skillName, sourceType) {
12785
12807
  if (!(0, import_fs.existsSync)(baseDir)) return null;
12786
- const directPath = (0, import_path.join)(baseDir, skillName);
12787
- const directSkillFile = (0, import_path.join)(directPath, "SKILL.md");
12808
+ const directPath = safeJoin(baseDir, skillName);
12809
+ const directSkillFile = safeJoin(directPath, "SKILL.md");
12788
12810
  if ((0, import_fs.existsSync)(directSkillFile)) {
12789
12811
  return {
12790
12812
  skillFile: directSkillFile,
@@ -12805,8 +12827,8 @@ function findSkillByName(baseDir, skillName, sourceType) {
12805
12827
  return null;
12806
12828
  }
12807
12829
  function getBootstrapContent(locusSkillsDir, compact = false) {
12808
- const usingLocusPath = (0, import_path.join)(locusSkillsDir, "using-locus", "SKILL.md");
12809
- const legacyLocusPath = (0, import_path.join)(locusSkillsDir, "locus", "SKILL.md");
12830
+ const usingLocusPath = safeJoin(locusSkillsDir, "using-locus", "SKILL.md");
12831
+ const legacyLocusPath = safeJoin(locusSkillsDir, "locus", "SKILL.md");
12810
12832
  let skillFile = null;
12811
12833
  if ((0, import_fs.existsSync)(usingLocusPath)) {
12812
12834
  skillFile = usingLocusPath;
@@ -12845,7 +12867,7 @@ function normalizePath(p, homeDir) {
12845
12867
  let normalized = p.trim();
12846
12868
  if (!normalized) return null;
12847
12869
  if (normalized.startsWith("~/")) {
12848
- normalized = (0, import_path.join)(homeDir, normalized.slice(2));
12870
+ normalized = safeJoin(homeDir, normalized.slice(2));
12849
12871
  } else if (normalized === "~") {
12850
12872
  normalized = homeDir;
12851
12873
  }