getprismo 0.1.0 → 0.1.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/lib/prismo-dev-scan.js +33 -14
- package/package.json +1 -1
package/lib/prismo-dev-scan.js
CHANGED
|
@@ -1291,6 +1291,13 @@ function renderArchitectureSummary(ctx) {
|
|
|
1291
1291
|
const apiLayer = ctx.backend.api.slice(0, 6);
|
|
1292
1292
|
const dbLayer = ctx.backend.db.slice(0, 6);
|
|
1293
1293
|
const frontendLayer = ctx.frontend.app.slice(0, 6);
|
|
1294
|
+
const readOrder = [
|
|
1295
|
+
"- Start here.",
|
|
1296
|
+
ctx.backendDetected ? "- For backend work, read `.prismo/backend-summary.md` next." : null,
|
|
1297
|
+
ctx.frontendDetected ? "- For frontend work, read `.prismo/frontend-summary.md` next." : null,
|
|
1298
|
+
"- Then inspect only the files directly relevant to the task.",
|
|
1299
|
+
"- Avoid broad recursive reads unless the task truly needs a repo-wide audit.",
|
|
1300
|
+
].filter(Boolean);
|
|
1294
1301
|
return [
|
|
1295
1302
|
"# Architecture Summary",
|
|
1296
1303
|
"",
|
|
@@ -1314,11 +1321,7 @@ function renderArchitectureSummary(ctx) {
|
|
|
1314
1321
|
"",
|
|
1315
1322
|
"## Recommended Read Order",
|
|
1316
1323
|
"",
|
|
1317
|
-
|
|
1318
|
-
ctx.backendDetected ? "- For backend work, read `.prismo/backend-summary.md` next." : "",
|
|
1319
|
-
ctx.frontendDetected ? "- For frontend work, read `.prismo/frontend-summary.md` next." : "",
|
|
1320
|
-
"- Then inspect only the files directly relevant to the task.",
|
|
1321
|
-
"- Avoid broad recursive reads unless the task truly needs a repo-wide audit.",
|
|
1324
|
+
readOrder.join("\n"),
|
|
1322
1325
|
"",
|
|
1323
1326
|
"## Key Entrypoints",
|
|
1324
1327
|
"",
|
|
@@ -1401,6 +1404,11 @@ function renderFrontendSummary(ctx) {
|
|
|
1401
1404
|
|
|
1402
1405
|
function renderRecommendedClaude(ctx) {
|
|
1403
1406
|
const commands = [];
|
|
1407
|
+
const importantPaths = [
|
|
1408
|
+
"- `.prismo/architecture-summary.md`",
|
|
1409
|
+
ctx.backendDetected ? "- `.prismo/backend-summary.md`" : null,
|
|
1410
|
+
ctx.frontendDetected ? "- `.prismo/frontend-summary.md`" : null,
|
|
1411
|
+
].filter(Boolean);
|
|
1404
1412
|
if (hasPath(ctx.scan, (rel) => rel === "package.json")) {
|
|
1405
1413
|
commands.push("npm run scan");
|
|
1406
1414
|
commands.push("npm run test:scan");
|
|
@@ -1433,9 +1441,7 @@ function renderRecommendedClaude(ctx) {
|
|
|
1433
1441
|
"",
|
|
1434
1442
|
"## Important Paths",
|
|
1435
1443
|
"",
|
|
1436
|
-
|
|
1437
|
-
ctx.backendDetected ? "- `.prismo/backend-summary.md`" : "",
|
|
1438
|
-
ctx.frontendDetected ? "- `.prismo/frontend-summary.md`" : "",
|
|
1444
|
+
importantPaths.join("\n"),
|
|
1439
1445
|
"",
|
|
1440
1446
|
].join("\n");
|
|
1441
1447
|
}
|
|
@@ -1829,15 +1835,27 @@ function getCodexSessionFiles() {
|
|
|
1829
1835
|
|
|
1830
1836
|
function getClaudeSessionFiles(cwd = process.cwd()) {
|
|
1831
1837
|
const claudeHome = process.env.PRISMO_CLAUDE_HOME || path.join(os.homedir(), ".claude");
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1834
|
-
|
|
1838
|
+
const candidates = [cwd];
|
|
1839
|
+
try {
|
|
1840
|
+
candidates.push(fs.realpathSync(cwd));
|
|
1841
|
+
} catch {
|
|
1842
|
+
// Keep the original cwd candidate when realpath is unavailable.
|
|
1843
|
+
}
|
|
1844
|
+
const files = [];
|
|
1845
|
+
for (const candidate of Array.from(new Set(candidates))) {
|
|
1846
|
+
const safeProject = candidate.replace(/[\/\\:]/g, "-").replace(/^-/, "-");
|
|
1847
|
+
const projectDir = path.join(claudeHome, "projects", safeProject);
|
|
1848
|
+
files.push(...listFilesRecursive(projectDir, (file) => file.endsWith(".jsonl"), 200));
|
|
1849
|
+
}
|
|
1850
|
+
return Array.from(new Set(files));
|
|
1835
1851
|
}
|
|
1836
1852
|
|
|
1837
1853
|
function sameResolvedPath(a, b) {
|
|
1838
1854
|
if (!a || !b) return false;
|
|
1839
1855
|
try {
|
|
1840
|
-
|
|
1856
|
+
const resolvedA = fs.existsSync(a) ? fs.realpathSync(a) : path.resolve(a);
|
|
1857
|
+
const resolvedB = fs.existsSync(b) ? fs.realpathSync(b) : path.resolve(b);
|
|
1858
|
+
return resolvedA === resolvedB;
|
|
1841
1859
|
} catch {
|
|
1842
1860
|
return false;
|
|
1843
1861
|
}
|
|
@@ -2095,10 +2113,11 @@ function runDevFlow(rootDir = process.cwd(), options = {}) {
|
|
|
2095
2113
|
const scanDone = printStep("Scanning repo and local usage", options.json);
|
|
2096
2114
|
const scan = scanRepo(root, { includeUsage: true, usageLimit: options.limit || 3 });
|
|
2097
2115
|
scanDone();
|
|
2116
|
+
const initialContext = createOptimizeContext(root);
|
|
2117
|
+
const scope = initialContext.frameworks.some((name) => ["Next.js", "React", "Vite"].includes(name)) ? "frontend" : null;
|
|
2098
2118
|
const optimizeDone = printStep("Generating compact context files", options.json);
|
|
2099
|
-
const optimize = runOptimize(root);
|
|
2119
|
+
const optimize = runOptimize(root, { scope });
|
|
2100
2120
|
optimizeDone();
|
|
2101
|
-
const scope = optimize.frameworks.some((name) => ["Next.js", "React", "Vite"].includes(name)) ? "frontend" : null;
|
|
2102
2121
|
const ctx = createOptimizeContext(root, scope);
|
|
2103
2122
|
const prompt = renderContextCommand(ctx, scope);
|
|
2104
2123
|
return {
|