@m8i-51/shoal 0.1.14 → 0.1.16
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/.env.example +6 -0
- package/framework/__tests__/coverage.test.ts +1 -0
- package/framework/__tests__/report.test.ts +1 -0
- package/framework/coverage.ts +11 -0
- package/framework/diary.ts +96 -0
- package/framework/persona-pack.ts +137 -0
- package/framework/trackers/asana.ts +13 -0
- package/framework/trackers/backlog.ts +14 -0
- package/framework/trackers/github.ts +18 -0
- package/framework/trackers/index.ts +9 -0
- package/framework/trackers/jira.ts +19 -0
- package/framework/trackers/notion.ts +16 -0
- package/framework/trackers/types.ts +1 -0
- package/framework/types.ts +1 -0
- package/package.json +3 -2
- package/run.ts +62 -9
- package/server/index.ts +38 -0
- package/web/dist/assets/index-BHrkJsFb.js +85 -0
- package/web/dist/index.html +1 -1
- package/web/dist/assets/index-BgIAUEzL.js +0 -68
package/server/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
|
7
7
|
import { listRuns, getReportPath } from "./runs.js";
|
|
8
8
|
import { activeSessions, spawnRun, cancelSession } from "./runner.js";
|
|
9
9
|
import { loadSchedule, saveSchedule, startScheduler, type ScheduleConfig } from "./scheduler.js";
|
|
10
|
+
import { generateDiary, getDiaryPath } from "../framework/diary.js";
|
|
10
11
|
|
|
11
12
|
function specFilePath(baseUrl: string): string {
|
|
12
13
|
try {
|
|
@@ -90,6 +91,43 @@ app.get("/api/runs", (_req, res) => {
|
|
|
90
91
|
res.json(enriched);
|
|
91
92
|
});
|
|
92
93
|
|
|
94
|
+
// ----------------------------------------------------------------
|
|
95
|
+
// API: diary for a run
|
|
96
|
+
// ----------------------------------------------------------------
|
|
97
|
+
app.get("/api/runs/:runId/diary", (req, res) => {
|
|
98
|
+
const { runId } = req.params;
|
|
99
|
+
if (!isValidRunId(runId)) { res.status(400).json({ error: "invalid run id" }); return; }
|
|
100
|
+
const p = getDiaryPath(runId);
|
|
101
|
+
if (!p) { res.status(404).json({ error: "diary not found" }); return; }
|
|
102
|
+
res.json({ content: readFileSync(p, "utf-8") });
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
app.post("/api/runs/:runId/diary", async (req, res) => {
|
|
106
|
+
const { runId } = req.params;
|
|
107
|
+
if (!isValidRunId(runId)) { res.status(400).json({ error: "invalid run id" }); return; }
|
|
108
|
+
|
|
109
|
+
const session = activeSessions.get(runId);
|
|
110
|
+
let lines: string[];
|
|
111
|
+
if (session) {
|
|
112
|
+
lines = session.lines;
|
|
113
|
+
} else {
|
|
114
|
+
const logFilePath = safeLogPath(`log_${runId}.txt`);
|
|
115
|
+
if (!logFilePath || !existsSync(logFilePath)) {
|
|
116
|
+
res.status(404).json({ error: "no log found" });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
lines = readFileSync(logFilePath, "utf-8").split("\n").filter((l) => l !== "");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
const content = await generateDiary(runId, lines);
|
|
124
|
+
res.json({ content });
|
|
125
|
+
} catch (err) {
|
|
126
|
+
console.error("[diary] generation failed:", err);
|
|
127
|
+
res.status(500).json({ error: "diary generation failed" });
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
93
131
|
// ----------------------------------------------------------------
|
|
94
132
|
// API: serve HTML report for a run
|
|
95
133
|
// ----------------------------------------------------------------
|