replicas-engine 0.1.29 → 0.1.30
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/src/index.js +14 -6
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -1890,6 +1890,7 @@ import { existsSync as existsSync3 } from "fs";
|
|
|
1890
1890
|
import { join as join5, basename } from "path";
|
|
1891
1891
|
import { homedir as homedir5 } from "os";
|
|
1892
1892
|
var PLANS_DIR = join5(homedir5(), ".replicas", "plans");
|
|
1893
|
+
var CLAUDE_PLANS_DIR = join5(homedir5(), ".claude", "plans");
|
|
1893
1894
|
function isValidFilename(filename) {
|
|
1894
1895
|
if (!filename.endsWith(".md")) {
|
|
1895
1896
|
return false;
|
|
@@ -1901,11 +1902,14 @@ async function ensurePlansDir() {
|
|
|
1901
1902
|
if (!existsSync3(PLANS_DIR)) {
|
|
1902
1903
|
await mkdir5(PLANS_DIR, { recursive: true });
|
|
1903
1904
|
}
|
|
1905
|
+
if (!existsSync3(CLAUDE_PLANS_DIR)) {
|
|
1906
|
+
await mkdir5(CLAUDE_PLANS_DIR, { recursive: true });
|
|
1907
|
+
}
|
|
1904
1908
|
}
|
|
1905
1909
|
async function listPlans() {
|
|
1906
1910
|
await ensurePlansDir();
|
|
1907
1911
|
try {
|
|
1908
|
-
const files = await readdir2(PLANS_DIR);
|
|
1912
|
+
const files = [...await readdir2(PLANS_DIR), ...await readdir2(CLAUDE_PLANS_DIR)];
|
|
1909
1913
|
return files.filter((file) => file.endsWith(".md")).sort((a, b) => a.localeCompare(b));
|
|
1910
1914
|
} catch {
|
|
1911
1915
|
return [];
|
|
@@ -1916,12 +1920,16 @@ async function getPlanContent(filename) {
|
|
|
1916
1920
|
throw new Error("Invalid filename");
|
|
1917
1921
|
}
|
|
1918
1922
|
await ensurePlansDir();
|
|
1919
|
-
const
|
|
1920
|
-
|
|
1921
|
-
|
|
1923
|
+
const safeName = basename(filename);
|
|
1924
|
+
const replicasPath = join5(PLANS_DIR, safeName);
|
|
1925
|
+
const claudePath = join5(CLAUDE_PLANS_DIR, safeName);
|
|
1926
|
+
if (existsSync3(replicasPath)) {
|
|
1927
|
+
return await readFile4(replicasPath, "utf-8");
|
|
1928
|
+
}
|
|
1929
|
+
if (existsSync3(claudePath)) {
|
|
1930
|
+
return await readFile4(claudePath, "utf-8");
|
|
1922
1931
|
}
|
|
1923
|
-
|
|
1924
|
-
return content;
|
|
1932
|
+
throw new Error("Plan not found");
|
|
1925
1933
|
}
|
|
1926
1934
|
|
|
1927
1935
|
// src/routes/plans.ts
|