locus-product-planning 1.2.3 → 1.2.5
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 +72 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +72 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12442,13 +12442,22 @@ import { readFileSync, existsSync, readdirSync } from "fs";
|
|
|
12442
12442
|
import { join, basename, dirname, resolve } from "path";
|
|
12443
12443
|
import { fileURLToPath } from "url";
|
|
12444
12444
|
var _cachedDirname = null;
|
|
12445
|
+
function safeString(value) {
|
|
12446
|
+
if (typeof value === "string" && value.length > 0) {
|
|
12447
|
+
return value;
|
|
12448
|
+
}
|
|
12449
|
+
return null;
|
|
12450
|
+
}
|
|
12445
12451
|
function getCurrentDirname() {
|
|
12446
|
-
if (_cachedDirname
|
|
12452
|
+
if (typeof _cachedDirname === "string" && _cachedDirname.length > 0) {
|
|
12453
|
+
return _cachedDirname;
|
|
12454
|
+
}
|
|
12447
12455
|
try {
|
|
12448
12456
|
const meta = import.meta;
|
|
12449
|
-
|
|
12450
|
-
|
|
12451
|
-
|
|
12457
|
+
const url2 = safeString(meta?.url);
|
|
12458
|
+
if (url2 && url2.startsWith("file:")) {
|
|
12459
|
+
const result = safeString(dirname(fileURLToPath(url2)));
|
|
12460
|
+
if (result) {
|
|
12452
12461
|
_cachedDirname = result;
|
|
12453
12462
|
return result;
|
|
12454
12463
|
}
|
|
@@ -12456,23 +12465,25 @@ function getCurrentDirname() {
|
|
|
12456
12465
|
} catch {
|
|
12457
12466
|
}
|
|
12458
12467
|
try {
|
|
12459
|
-
const globalDirname = globalThis.__dirname;
|
|
12460
|
-
if (
|
|
12468
|
+
const globalDirname = safeString(globalThis.__dirname);
|
|
12469
|
+
if (globalDirname) {
|
|
12461
12470
|
_cachedDirname = globalDirname;
|
|
12462
12471
|
return globalDirname;
|
|
12463
12472
|
}
|
|
12464
12473
|
} catch {
|
|
12465
12474
|
}
|
|
12466
12475
|
try {
|
|
12467
|
-
const packageJsonPath = __require.resolve("locus-product-planning/package.json");
|
|
12468
|
-
if (
|
|
12469
|
-
const result = join(dirname(packageJsonPath), "dist");
|
|
12470
|
-
|
|
12471
|
-
|
|
12476
|
+
const packageJsonPath = safeString(__require.resolve("locus-product-planning/package.json"));
|
|
12477
|
+
if (packageJsonPath) {
|
|
12478
|
+
const result = safeString(join(dirname(packageJsonPath), "dist"));
|
|
12479
|
+
if (result) {
|
|
12480
|
+
_cachedDirname = result;
|
|
12481
|
+
return result;
|
|
12482
|
+
}
|
|
12472
12483
|
}
|
|
12473
12484
|
} catch {
|
|
12474
12485
|
}
|
|
12475
|
-
const homeDir = process.env.USERPROFILE || process.env.HOME
|
|
12486
|
+
const homeDir = safeString(process.env.USERPROFILE) || safeString(process.env.HOME);
|
|
12476
12487
|
if (homeDir) {
|
|
12477
12488
|
const cacheLocations = [
|
|
12478
12489
|
join(homeDir, ".cache", "opencode", "node_modules", "locus-product-planning", "dist"),
|
|
@@ -12481,39 +12492,69 @@ function getCurrentDirname() {
|
|
|
12481
12492
|
for (const loc of cacheLocations) {
|
|
12482
12493
|
try {
|
|
12483
12494
|
if (existsSync(loc)) {
|
|
12484
|
-
|
|
12485
|
-
|
|
12495
|
+
const result = safeString(loc);
|
|
12496
|
+
if (result) {
|
|
12497
|
+
_cachedDirname = result;
|
|
12498
|
+
return result;
|
|
12499
|
+
}
|
|
12486
12500
|
}
|
|
12487
12501
|
} catch {
|
|
12488
12502
|
}
|
|
12489
12503
|
}
|
|
12490
12504
|
}
|
|
12491
|
-
const cwd = process.cwd();
|
|
12492
|
-
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
|
|
12496
|
-
|
|
12497
|
-
|
|
12498
|
-
|
|
12499
|
-
|
|
12505
|
+
const cwd = safeString(process.cwd());
|
|
12506
|
+
if (cwd) {
|
|
12507
|
+
try {
|
|
12508
|
+
const pkgPath = resolve(cwd, "package.json");
|
|
12509
|
+
if (existsSync(pkgPath)) {
|
|
12510
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
12511
|
+
if (pkg.name === "locus-product-planning") {
|
|
12512
|
+
const result = safeString(resolve(cwd, "dist"));
|
|
12513
|
+
if (result) {
|
|
12514
|
+
_cachedDirname = result;
|
|
12515
|
+
return result;
|
|
12516
|
+
}
|
|
12517
|
+
}
|
|
12500
12518
|
}
|
|
12519
|
+
} catch {
|
|
12501
12520
|
}
|
|
12502
|
-
|
|
12521
|
+
const fallback = safeString(resolve(cwd, "dist"));
|
|
12522
|
+
if (fallback) {
|
|
12523
|
+
_cachedDirname = fallback;
|
|
12524
|
+
return fallback;
|
|
12525
|
+
}
|
|
12526
|
+
}
|
|
12527
|
+
const absoluteFallback = "/tmp/locus-product-planning/dist";
|
|
12528
|
+
_cachedDirname = absoluteFallback;
|
|
12529
|
+
return absoluteFallback;
|
|
12530
|
+
}
|
|
12531
|
+
var _currentDirname = null;
|
|
12532
|
+
function ensureCurrentDirname() {
|
|
12533
|
+
if (_currentDirname === null) {
|
|
12534
|
+
_currentDirname = getCurrentDirname();
|
|
12503
12535
|
}
|
|
12504
|
-
|
|
12505
|
-
_cachedDirname = fallback;
|
|
12506
|
-
return fallback;
|
|
12536
|
+
return _currentDirname;
|
|
12507
12537
|
}
|
|
12508
|
-
var currentDirname = getCurrentDirname();
|
|
12509
12538
|
function getPackageRoot() {
|
|
12510
|
-
|
|
12539
|
+
const dir = ensureCurrentDirname();
|
|
12540
|
+
if (dir.endsWith("/") || dir.endsWith("\\")) {
|
|
12541
|
+
return dir + "..";
|
|
12542
|
+
}
|
|
12543
|
+
const lastSlash = Math.max(dir.lastIndexOf("/"), dir.lastIndexOf("\\"));
|
|
12544
|
+
if (lastSlash > 0) {
|
|
12545
|
+
return dir.substring(0, lastSlash);
|
|
12546
|
+
}
|
|
12547
|
+
return dir;
|
|
12511
12548
|
}
|
|
12512
12549
|
function getLocusSkillsDir() {
|
|
12513
|
-
|
|
12550
|
+
const root = getPackageRoot();
|
|
12551
|
+
const sep = root.includes("\\") ? "\\" : "/";
|
|
12552
|
+
return root + sep + "skills";
|
|
12514
12553
|
}
|
|
12515
12554
|
function getLocusAgentsDir() {
|
|
12516
|
-
|
|
12555
|
+
const root = getPackageRoot();
|
|
12556
|
+
const sep = root.includes("\\") ? "\\" : "/";
|
|
12557
|
+
return root + sep + "agents";
|
|
12517
12558
|
}
|
|
12518
12559
|
function extractFrontmatter(filePath) {
|
|
12519
12560
|
try {
|