Add Multi-CLI Plan feature and corresponding JSON schema

- Introduced a new navigation item for "Multi-CLI Plan" in the dashboard template.
- Created a new JSON schema for "Multi-CLI Discussion Artifact" to facilitate structured discussions and decision-making processes.
This commit is contained in:
catlog22
2026-01-13 23:46:15 +08:00
parent c3da637849
commit 6922ca27de
12 changed files with 2535 additions and 274 deletions

View File

@@ -7,9 +7,9 @@ import { join } from 'path';
import type { RouteContext } from './types.js';
/**
* Get session detail data (context, summaries, impl-plan, review)
* Get session detail data (context, summaries, impl-plan, review, multi-cli)
* @param {string} sessionPath - Path to session directory
* @param {string} dataType - Type of data to load ('all', 'context', 'tasks', 'summary', 'plan', 'explorations', 'conflict', 'impl-plan', 'review')
* @param {string} dataType - Type of data to load ('all', 'context', 'tasks', 'summary', 'plan', 'explorations', 'conflict', 'impl-plan', 'review', 'multi-cli', 'discussions')
* @returns {Promise<Object>}
*/
async function getSessionDetailData(sessionPath: string, dataType: string): Promise<Record<string, unknown>> {
@@ -251,6 +251,44 @@ async function getSessionDetailData(sessionPath: string, dataType: string): Prom
}
}
// Load multi-cli discussion rounds (rounds/*/synthesis.json)
if (dataType === 'multi-cli' || dataType === 'discussions' || dataType === 'all') {
result.multiCli = {
sessionId: normalizedPath.split('/').pop() || '',
type: 'multi-cli-plan',
rounds: [] as Array<{ roundNumber: number; synthesis: Record<string, unknown> | null }>
};
const roundsDir = join(normalizedPath, 'rounds');
if (existsSync(roundsDir)) {
try {
const roundDirs = readdirSync(roundsDir)
.filter(d => /^\d+$/.test(d)) // Only numeric directories
.sort((a, b) => parseInt(a) - parseInt(b));
for (const roundDir of roundDirs) {
const synthesisFile = join(roundsDir, roundDir, 'synthesis.json');
let synthesis: Record<string, unknown> | null = null;
if (existsSync(synthesisFile)) {
try {
synthesis = JSON.parse(readFileSync(synthesisFile, 'utf8'));
} catch (e) {
// Skip unreadable synthesis files
}
}
result.multiCli.rounds.push({
roundNumber: parseInt(roundDir),
synthesis
});
}
} catch (e) {
// Directory read failed
}
}
}
// Load review data from .review/
if (dataType === 'review' || dataType === 'all') {
const reviewDir = join(normalizedPath, '.review');