locus-product-planning 1.2.5 → 1.2.8
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 +38 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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((
|
|
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
|
-
(
|
|
12526
|
-
(
|
|
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 = (
|
|
12734
|
+
const fullPath = safeJoin(currentDir, entry.name);
|
|
12713
12735
|
if (entry.isDirectory()) {
|
|
12714
|
-
const skillFile = (
|
|
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 = (
|
|
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")) {
|
|
@@ -12765,6 +12787,9 @@ function findAgentsInDir(dir, maxDepth = 3) {
|
|
|
12765
12787
|
return agents;
|
|
12766
12788
|
}
|
|
12767
12789
|
function resolveSkillPath(skillName, locusSkillsDir, personalSkillsDir, projectSkillsDir) {
|
|
12790
|
+
if (typeof skillName !== "string" || !skillName) {
|
|
12791
|
+
return null;
|
|
12792
|
+
}
|
|
12768
12793
|
const forceProject = skillName.startsWith("project:");
|
|
12769
12794
|
const forceLocus = skillName.startsWith("locus:");
|
|
12770
12795
|
const actualSkillName = skillName.replace(/^project:/, "").replace(/^locus:/, "");
|
|
@@ -12782,9 +12807,11 @@ function resolveSkillPath(skillName, locusSkillsDir, personalSkillsDir, projectS
|
|
|
12782
12807
|
return null;
|
|
12783
12808
|
}
|
|
12784
12809
|
function findSkillByName(baseDir, skillName, sourceType) {
|
|
12810
|
+
if (typeof baseDir !== "string" || !baseDir) return null;
|
|
12811
|
+
if (typeof skillName !== "string" || !skillName) return null;
|
|
12785
12812
|
if (!(0, import_fs.existsSync)(baseDir)) return null;
|
|
12786
|
-
const directPath = (
|
|
12787
|
-
const directSkillFile = (
|
|
12813
|
+
const directPath = safeJoin(baseDir, skillName);
|
|
12814
|
+
const directSkillFile = safeJoin(directPath, "SKILL.md");
|
|
12788
12815
|
if ((0, import_fs.existsSync)(directSkillFile)) {
|
|
12789
12816
|
return {
|
|
12790
12817
|
skillFile: directSkillFile,
|
|
@@ -12805,8 +12832,8 @@ function findSkillByName(baseDir, skillName, sourceType) {
|
|
|
12805
12832
|
return null;
|
|
12806
12833
|
}
|
|
12807
12834
|
function getBootstrapContent(locusSkillsDir, compact = false) {
|
|
12808
|
-
const usingLocusPath = (
|
|
12809
|
-
const legacyLocusPath = (
|
|
12835
|
+
const usingLocusPath = safeJoin(locusSkillsDir, "using-locus", "SKILL.md");
|
|
12836
|
+
const legacyLocusPath = safeJoin(locusSkillsDir, "locus", "SKILL.md");
|
|
12810
12837
|
let skillFile = null;
|
|
12811
12838
|
if ((0, import_fs.existsSync)(usingLocusPath)) {
|
|
12812
12839
|
skillFile = usingLocusPath;
|
|
@@ -12845,7 +12872,7 @@ function normalizePath(p, homeDir) {
|
|
|
12845
12872
|
let normalized = p.trim();
|
|
12846
12873
|
if (!normalized) return null;
|
|
12847
12874
|
if (normalized.startsWith("~/")) {
|
|
12848
|
-
normalized = (
|
|
12875
|
+
normalized = safeJoin(homeDir, normalized.slice(2));
|
|
12849
12876
|
} else if (normalized === "~") {
|
|
12850
12877
|
normalized = homeDir;
|
|
12851
12878
|
}
|