Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opencode-forge",
"version": "0.4.15",
"version": "0.4.16",
"type": "module",
"oc-plugin": [
"server",
Expand Down
12 changes: 12 additions & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ writeFileSync(versionPath, versionContent, 'utf-8')

console.log(`Version ${version} written to src/version.ts`)

console.log('Generating dashboard marked-source...')
const markedMinPath = join(__dirname, '..', 'src', 'dashboard', 'marked.min.js')
const markedSourcePath = join(__dirname, '..', 'src', 'dashboard', 'marked-source.ts')
const markedRaw = readFileSync(markedMinPath, 'utf-8')
// Use JSON.stringify for proper JS string escaping (handles backticks, $, quotes, etc.)
const markedEscaped = JSON.stringify(markedRaw)
const markedSourceContent = `// Auto-generated from marked.min.js. Do not edit.
export const MARKED_SOURCE: string = ${markedEscaped};
`
writeFileSync(markedSourcePath, markedSourceContent, 'utf-8')
console.log('Dashboard marked-source generated.')

console.log('Compiling main code...')
execSync('tsc -p tsconfig.build.json', {
cwd: join(__dirname, '..'),
Expand Down
6 changes: 5 additions & 1 deletion src/dashboard/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { LoopRow } from '../storage'
import type { SectionPlanRow } from '../storage'
import type { ReviewFindingRow } from '../storage'
import type { LoopUsageAggregate } from '../storage'
import { formatDuration, computeElapsedSeconds } from '../utils/loop-helpers'

export interface DashboardLoop {
loop: LoopRow
Expand All @@ -18,6 +19,7 @@ export interface DashboardLoop {
sections: SectionPlanRow[]
findings: ReviewFindingRow[]
usage: LoopUsageAggregate | null
duration: string | null
}

export interface DashboardProject {
Expand Down Expand Up @@ -87,8 +89,10 @@ export function collectDashboardData(db: Database): DashboardPayload {
const sections = sectionPlansRepo.list(projectId, loopName)
const findings = reviewFindingsRepo.listByLoopName(projectId, loopName)
const usage = loopSessionUsageRepo.getAggregate(projectId, loopName)
const elapsedSeconds = computeElapsedSeconds(loop.startedAt, loop.completedAt ?? undefined)
const duration = elapsedSeconds > 0 ? formatDuration(elapsedSeconds) : null

return { loop, lastAuditResult, plan, sections, findings, usage }
return { loop, lastAuditResult, plan, sections, findings, usage, duration }
})

projects.push({ projectId, projectDir, loops: dashboardLoops })
Expand Down
2 changes: 2 additions & 0 deletions src/dashboard/marked-source.ts

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/dashboard/marked.min.js

Large diffs are not rendered by default.

Loading