heyiam 0.2.25 → 0.2.27
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/export.js
CHANGED
|
@@ -90,14 +90,14 @@ function writeAndTrack(filePath, content, files) {
|
|
|
90
90
|
return statSync(filePath).size;
|
|
91
91
|
}
|
|
92
92
|
// ── Markdown Export ────────────────────────────────────────────
|
|
93
|
-
export async function exportMarkdown(dirName, cache, sessions, outputPath) {
|
|
93
|
+
export async function exportMarkdown(dirName, cache, sessions, outputPath, opts) {
|
|
94
94
|
const files = [];
|
|
95
95
|
let totalBytes = 0;
|
|
96
96
|
mkdirSync(outputPath, { recursive: true });
|
|
97
97
|
const { result } = cache;
|
|
98
98
|
const title = cache.title ?? displayNameFromDir(dirName);
|
|
99
99
|
// README.md — project narrative
|
|
100
|
-
const readme = buildReadme(title, result, sessions);
|
|
100
|
+
const readme = buildReadme(title, result, sessions, opts?.totalFilesChanged);
|
|
101
101
|
totalBytes += writeAndTrack(join(outputPath, 'README.md'), readme, files);
|
|
102
102
|
// sessions/*.md — per-session breakdowns
|
|
103
103
|
const sessionsDir = join(outputPath, 'sessions');
|
|
@@ -113,7 +113,7 @@ export async function exportMarkdown(dirName, cache, sessions, outputPath) {
|
|
|
113
113
|
totalBytes += writeAndTrack(join(outputPath, 'project.json'), projectJson, files);
|
|
114
114
|
return { files, totalBytes, outputPath };
|
|
115
115
|
}
|
|
116
|
-
function buildReadme(title, result, sessions) {
|
|
116
|
+
function buildReadme(title, result, sessions, totalFilesChanged) {
|
|
117
117
|
const lines = [];
|
|
118
118
|
lines.push(`# ${title}\n`);
|
|
119
119
|
lines.push(result.narrative);
|
|
@@ -146,7 +146,7 @@ function buildReadme(title, result, sessions) {
|
|
|
146
146
|
lines.push(`- Sessions: ${sessions.length}`);
|
|
147
147
|
const totalLoc = sessions.reduce((sum, s) => sum + s.linesOfCode, 0);
|
|
148
148
|
const totalMin = computeMergedSessionDuration(sessions);
|
|
149
|
-
const totalFiles = sessions.
|
|
149
|
+
const totalFiles = totalFilesChanged ?? new Set(sessions.flatMap(s => s.filesChanged.map(f => f.path))).size;
|
|
150
150
|
lines.push(`- Lines of code: ${totalLoc.toLocaleString()}`);
|
|
151
151
|
lines.push(`- Total time: ${(totalMin / 60).toFixed(1)}h`);
|
|
152
152
|
lines.push(`- Files changed: ${totalFiles}`);
|
|
@@ -223,7 +223,7 @@ export async function exportHtml(dirName, cache, sessions, outputPath, username
|
|
|
223
223
|
// Compute stats the same way the dashboard does
|
|
224
224
|
const totalLoc = sessions.reduce((sum, s) => sum + s.linesOfCode, 0);
|
|
225
225
|
const totalDurationMinutes = computeMergedSessionDuration(sessions);
|
|
226
|
-
const totalFilesChanged = opts?.totalFilesChanged ?? sessions.
|
|
226
|
+
const totalFilesChanged = opts?.totalFilesChanged ?? new Set(sessions.flatMap(s => s.filesChanged.map(f => f.path))).size;
|
|
227
227
|
// Agent duration: sum child durations across all orchestrated sessions
|
|
228
228
|
const totalAgentMinutes = sessions
|
|
229
229
|
.filter((s) => s.isOrchestrated && s.children)
|
|
@@ -317,7 +317,7 @@ function buildProjectRenderInputs(dirName, cache, sessions, username, opts) {
|
|
|
317
317
|
}));
|
|
318
318
|
const totalLoc = sessions.reduce((sum, s) => sum + s.linesOfCode, 0);
|
|
319
319
|
const totalDurationMinutes = computeMergedSessionDuration(sessions);
|
|
320
|
-
const totalFilesChanged = opts?.totalFilesChanged ?? sessions.
|
|
320
|
+
const totalFilesChanged = opts?.totalFilesChanged ?? new Set(sessions.flatMap(s => s.filesChanged.map(f => f.path))).size;
|
|
321
321
|
const totalAgentMinutes = sessions
|
|
322
322
|
.filter((s) => s.isOrchestrated && s.children)
|
|
323
323
|
.reduce((sum, s) => sum + s.children.reduce((cs, c) => cs + c.durationMinutes, 0), 0);
|