zdashboard 1.0.0 → 1.0.1

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/cli.js CHANGED
@@ -312,7 +312,7 @@ function allBuiltins() {
312
312
  // package.json
313
313
  var package_default = {
314
314
  name: "zdashboard",
315
- version: "1.0.0",
315
+ version: "1.0.1",
316
316
  description: "ZCode skill dashboard platform \u2014 pluggable viewers for zdesign/zview/zreview/zgoal",
317
317
  type: "module",
318
318
  bin: { zdashboard: "./dist/cli.js" },
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server/index.ts","../src/server/spec-scan.ts","../src/server/just-runner.ts","../src/server/bugs.ts","../src/server/plugins.ts","../package.json","../src/server/detect.ts","../src/cli.ts"],"sourcesContent":["import http from 'node:http';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport crypto from 'node:crypto';\nimport { exec } from 'node:child_process';\nimport { fileURLToPath } from 'node:url';\nimport { scanTree } from './spec-scan.js';\nimport { JustRunner } from './just-runner.js';\nimport { fetchBugs } from './bugs.js';\nimport { registerBuiltin, allBuiltins, type DashboardPlugin } from './plugins.js';\nimport type { DetectResult } from './detect.js';\nimport pkg from '../../package.json' with { type: 'json' };\n\nconst VERSION = pkg.version;\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst STOP_TOKEN = crypto.randomBytes(12).toString('hex');\nconst INJECT = `<script>(function(){try{var es=new EventSource('/__reload');es.addEventListener('reload',function(){location.reload();});es.onerror=function(){es.close();};}catch(e){}document.addEventListener('click',function(e){var t=e.target;if(t&&t.closest){var a=t.closest('a[target]');if(a&&a.target!=='_self'){a.target='_self';}}},true);})();</script>`;\n\nconst MIME: Record<string, string> = {\n '.html': 'text/html; charset=utf-8', '.htm': 'text/html; charset=utf-8',\n '.css': 'text/css; charset=utf-8', '.js': 'application/javascript; charset=utf-8',\n '.mjs': 'application/javascript; charset=utf-8', '.json': 'application/json; charset=utf-8',\n '.svg': 'image/svg+xml', '.png': 'image/png', '.ico': 'image/x-icon',\n '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.gif': 'image/gif', '.webp': 'image/webp',\n '.md': 'text/markdown; charset=utf-8', '.txt': 'text/plain; charset=utf-8',\n '.yml': 'text/yaml; charset=utf-8', '.yaml': 'text/yaml; charset=utf-8',\n '.woff': 'font/woff', '.woff2': 'font/woff2', '.ttf': 'font/ttf',\n '.map': 'application/json; charset=utf-8',\n};\n\nexport interface ServerOptions {\n root: string;\n port?: number;\n open?: boolean;\n detect: DetectResult;\n dashboardDir?: string;\n mode?: string;\n}\n\nfunction readBody(req: http.IncomingMessage): Promise<string> {\n return new Promise((resolve) => {\n let data = '';\n req.on('data', (c) => (data += c));\n req.on('end', () => resolve(data));\n });\n}\n\nexport function createServer(opts: ServerOptions) {\n const ROOT = path.resolve(opts.root);\n const PORT0 = opts.port ?? 4190;\n const OPEN = !!opts.open;\n const APP_DIR = opts.dashboardDir ?? path.resolve(__dirname, 'web');\n if (!fs.existsSync(ROOT)) fs.mkdirSync(ROOT, { recursive: true });\n const det = opts.detect;\n const runner = new JustRunner(ROOT);\n const MODE = opts.mode;\n\n // register builtin plugins (server-side: apiRoutes only; viewer loaded by frontend)\n registerBuiltin({\n mode: 'bugs', label: '禅道 Bugs', icon: '🎯',\n apiRoutes: { '/__bugs': async (_, res) => { res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache' }); fetchBugs(ROOT).then((r) => res.end(JSON.stringify(r))); } }\n });\n registerBuiltin({ mode: 'view', label: '项目浏览', icon: '👁️' });\n registerBuiltin({ mode: 'review', label: '文档评审', icon: '✅' });\n\n const clients = new Set<http.ServerResponse>();\n const broadcast = (ev: string, data: unknown = '') => {\n const payload = `event: ${ev}\\ndata: ${JSON.stringify(data == null ? '' : data)}\\n\\n`;\n for (const c of clients) c.write(payload);\n };\n\n function serveFile(filePath: string, res: http.ServerResponse, injectHtml: boolean) {\n fs.readFile(filePath, (err, data) => {\n if (err) { res.writeHead(404); return res.end('Not found'); }\n const ext = path.extname(filePath).toLowerCase();\n const ct = MIME[ext] ?? 'application/octet-stream';\n let body = data;\n if (injectHtml && ext === '.html') {\n const s = data.toString('utf8');\n body = Buffer.from(s.indexOf('</body>') >= 0 ? s.replace('</body>', INJECT + '</body>') : s + INJECT);\n }\n res.writeHead(200, { 'Content-Type': ct, 'Cache-Control': 'no-cache' });\n res.end(body);\n });\n }\n\n function handler(req: http.IncomingMessage, res: http.ServerResponse) {\n const url = req.url!.split('?')[0];\n\n // ── SSE:文件变更 ──\n if (url === '/__reload') {\n res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', Connection: 'keep-alive' });\n res.write(': connected\\n\\n');\n clients.add(res);\n req.on('close', () => clients.delete(res));\n return;\n }\n if (url === '/__config') {\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache' });\n return res.end(JSON.stringify({ stopToken: STOP_TOKEN }));\n }\n if (url === '/__stop' && req.method === 'POST') {\n if (req.headers['x-stop-token'] === STOP_TOKEN) {\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });\n res.end('{\"ok\":true}');\n runner.stop();\n setTimeout(() => { try { server.close(); } catch {} process.exit(0); }, 50);\n } else { res.writeHead(403); res.end('forbidden'); }\n return;\n }\n\n // ── 方案模式:树形文件清单(+探测结果) ──\n if (url === '/__files') {\n const tree = scanTree(ROOT, det.hasOpenspec, det.hasDocs);\n const payload: TreeNodePayload = { tree, ...det };\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache' });\n return res.end(JSON.stringify(payload));\n }\n\n // ── 日志能力 ──\n if (url === '/__just/recipes') {\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache' });\n runner.recipes().then((r) => res.end(JSON.stringify(r)));\n return;\n }\n if (url === '/__just/logs') {\n res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', Connection: 'keep-alive' });\n res.write(': connected\\n\\n');\n const unsub = runner.subscribe((ev) => res.write(`data: ${JSON.stringify(ev)}\\n\\n`));\n req.on('close', unsub);\n return;\n }\n const justAction = url.match(/^\\/__just\\/(start|stop|restart)$/);\n if (justAction && req.method === 'POST') {\n (async () => {\n if (req.headers['x-stop-token'] !== STOP_TOKEN) { res.writeHead(403); res.end('forbidden'); return; }\n const body = await readBody(req);\n let recipe: string | undefined;\n try { recipe = JSON.parse(body || '{}').recipe; } catch { /* ignore */ }\n const act = justAction[1];\n if (act === 'start' || act === 'restart') {\n const target = recipe ?? runner.info().recipe;\n if (!target) { res.writeHead(400); res.end('{\"error\":\"no recipe\"}'); return; }\n const recipes = await runner.recipes();\n if (!recipes.some((r) => r.name === target)) { res.writeHead(403); res.end('{\"error\":\"unknown recipe\"}'); return; }\n runner.start(target);\n } else {\n runner.stop();\n }\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });\n res.end(JSON.stringify(runner.info()));\n })();\n return;\n }\n\n // ── plugin API routes ──\n let handled = false;\n for (const plugin of allBuiltins()) {\n if (!plugin.apiRoutes) continue;\n for (const [route, handler] of Object.entries(plugin.apiRoutes)) {\n if (url === route) {\n handled = true;\n handler(req, res, ROOT);\n return;\n }\n }\n }\n\n // ── dashboard 前端 ──\n if (url === '/') return serveFile(path.join(APP_DIR, 'index.html'), res, false);\n if (url.indexOf('/__app/') === 0) {\n const fp = path.join(APP_DIR, url.slice(7));\n if (fp !== APP_DIR && fp.indexOf(APP_DIR + path.sep) !== 0) { res.writeHead(403); return res.end('Forbidden'); }\n return serveFile(fp, res, false);\n }\n if (url.indexOf('/assets/') === 0) {\n const fp = path.join(APP_DIR, decodeURIComponent(url));\n if (fp.indexOf(APP_DIR + path.sep) !== 0) { res.writeHead(403); return res.end('Forbidden'); }\n return serveFile(fp, res, false);\n }\n\n // ── 用户资产 ──\n const fp = path.join(ROOT, decodeURIComponent(url));\n if (fp !== ROOT && fp.indexOf(ROOT + path.sep) !== 0) { res.writeHead(403); return res.end('Forbidden'); }\n return serveFile(fp, res, true);\n }\n\n let server: http.Server;\n function start(port: number) {\n server = http.createServer(handler);\n server.on('error', (err: NodeJS.ErrnoException) => {\n if (err.code === 'EADDRINUSE') { console.log(`[zdashboard] port ${port} busy, trying ${port + 1}`); start(port + 1); }\n else throw err;\n });\n server.listen(port, () => {\n const u = `http://localhost:${port}`;\n console.log(`[zdashboard] v${VERSION} dashboard -> ${u}`);\n console.log(`[zdashboard] project -> ${ROOT}`);\n console.log(`[zdashboard] mode -> ${MODE ?? '(auto)'}`);\n console.log(`[zdashboard] detect -> openspec:${det.hasOpenspec} docs:${det.hasDocs} just:${det.hasJust} bugs:${det.hasBugs}`);\n if (OPEN) exec(process.platform === 'darwin' ? `open ${u}` : `start ${u}`);\n });\n }\n\n let debounce: NodeJS.Timeout;\n try {\n fs.watch(ROOT, { recursive: true }, () => {\n clearTimeout(debounce);\n debounce = setTimeout(() => {\n broadcast('reload');\n broadcast('files');\n console.log(`[zdashboard] change -> reload + refresh tree (${clients.size} client${clients.size === 1 ? '' : 's'})`);\n }, 150);\n });\n } catch { console.log('[zdashboard] watch unavailable - static only.'); }\n\n start(PORT0);\n}\n\ninterface TreeNodePayload { tree: unknown; hasOpenspec: boolean; hasDocs: boolean; hasJust: boolean; hasBugs: boolean; }\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nexport type NodeKind = 'file' | 'dir' | 'log';\nexport interface TreeNode {\n name: string;\n kind: NodeKind;\n path?: string; // file: 相对 root 的路径(点击预览用)\n defaultCollapsed?: boolean;\n children?: TreeNode[];\n}\n\nfunction walkFiles(absDir: string, relDir: string, depth = 0): TreeNode[] {\n if (depth > 4) return [];\n let ents: fs.Dirent[];\n try { ents = fs.readdirSync(absDir, { withFileTypes: true }); } catch { return []; }\n const nodes: TreeNode[] = [];\n for (const ent of ents) {\n if (ent.name.startsWith('.') || ent.name === 'node_modules') continue;\n const rel = relDir ? `${relDir}/${ent.name}` : ent.name;\n if (ent.isDirectory()) {\n nodes.push({ name: ent.name, kind: 'dir', children: walkFiles(path.join(absDir, ent.name), rel, depth + 1) });\n } else {\n nodes.push({ name: ent.name, kind: 'file', path: rel });\n }\n }\n nodes.sort((a, b) => (a.kind === b.kind ? a.name.localeCompare(b.name) : a.kind === 'dir' ? -1 : 1));\n return nodes;\n}\n\n/** 方案模式树形扫描:openspec 感知 + docs 聚合 + 其他兜底 */\nexport function scanTree(root: string, hasOpenspec: boolean, hasDocs: boolean): TreeNode[] {\n const tree: TreeNode[] = [];\n if (hasOpenspec && fs.existsSync(path.join(root, 'openspec', 'changes'))) {\n const changesDir = path.join(root, 'openspec', 'changes');\n const active: TreeNode[] = [];\n const archived: TreeNode[] = [];\n for (const ent of fs.readdirSync(changesDir, { withFileTypes: true })) {\n if (!ent.isDirectory() || ent.name.startsWith('.') || ent.name === 'archive') continue;\n active.push({ name: ent.name, kind: 'dir', children: walkFiles(path.join(changesDir, ent.name), `openspec/changes/${ent.name}`) });\n }\n active.sort((a, b) => a.name.localeCompare(b.name));\n const archiveDir = path.join(changesDir, 'archive');\n if (fs.existsSync(archiveDir)) {\n for (const ent of fs.readdirSync(archiveDir, { withFileTypes: true })) {\n if (!ent.isDirectory() || ent.name.startsWith('.')) continue;\n archived.push({ name: ent.name, kind: 'dir', children: walkFiles(path.join(archiveDir, ent.name), `openspec/changes/archive/${ent.name}`) });\n }\n archived.sort((a, b) => b.name.localeCompare(a.name)); // 日期前缀倒序\n }\n if (active.length) tree.push({ name: `进行中 (${active.length})`, kind: 'dir', children: active });\n if (archived.length) tree.push({ name: `归档 (${archived.length})`, kind: 'dir', defaultCollapsed: true, children: archived });\n const specsDir = path.join(root, 'openspec', 'specs');\n if (fs.existsSync(specsDir)) {\n const specs = walkFiles(specsDir, 'openspec/specs');\n if (specs.length) tree.push({ name: '能力 Specs', kind: 'dir', children: specs });\n }\n }\n if (hasDocs && fs.existsSync(path.join(root, 'docs'))) {\n const docs = walkFiles(path.join(root, 'docs'), 'docs');\n if (docs.length) tree.push({ name: 'docs', kind: 'dir', children: docs });\n }\n const skip = new Set(['openspec', 'docs', 'node_modules', '.git', 'dist', 'test-server']);\n // \"其他\"只收根目录的 md 文档(README/CLAUDE 等);构建配置(pom.xml/justfile 等)不收——对\"方案+日志\"定位是噪音\n const etc: TreeNode[] = [];\n try {\n for (const ent of fs.readdirSync(root, { withFileTypes: true })) {\n if (ent.name.startsWith('.') || skip.has(ent.name)) continue;\n const ext = path.extname(ent.name).toLowerCase();\n if (ent.isFile() && (ext === '.md' || ext === '.markdown')) etc.push({ name: ent.name, kind: 'file', path: ent.name });\n }\n } catch {}\n etc.sort((a, b) => a.name.localeCompare(b.name));\n if (etc.length) tree.push({ name: `其他 (${etc.length})`, kind: 'dir', children: etc });\n return tree;\n}\n","import { spawn, execFile, type ChildProcess } from 'node:child_process';\n\nexport interface Recipe { name: string; description: string; }\nexport type JustState = 'idle' | 'running' | 'exited';\nexport type JustEvent =\n | { type: 'log'; text: string }\n | { type: 'clear' }\n | { type: 'state'; state: JustState; recipe: string | null; code: number | null };\n\nconst MAX_BUFFER = 1000;\n\nexport class JustRunner {\n private cwd: string;\n private child: ChildProcess | null = null;\n private recipe: string | null = null;\n private state: JustState = 'idle';\n private code: number | null = null;\n private buffer: string[] = [];\n private pending = ''; // 行缓冲:块缓冲输出(如 maven)的 chunk 会在行中间断开,攒到 \\n 才切行\n private clients = new Set<(ev: JustEvent) => void>();\n private recipesCache: Recipe[] | null = null;\n\n constructor(cwd: string) { this.cwd = cwd; }\n\n recipes(): Promise<Recipe[]> {\n if (this.recipesCache) return Promise.resolve(this.recipesCache);\n return new Promise((resolve) => {\n execFile('just', ['--list', '--unsorted'], { cwd: this.cwd, maxBuffer: 1 << 20, timeout: 8000 }, (err, stdout) => {\n if (err) { resolve([]); return; }\n const out: Recipe[] = [];\n const seen = new Set<string>();\n for (const line of stdout.split(/\\r?\\n/).slice(1)) { // 跳过 \"Available recipes:\"\n const trimmed = line.trim();\n if (!trimmed) continue;\n const hashIdx = trimmed.indexOf('#');\n const sig = (hashIdx >= 0 ? trimmed.slice(0, hashIdx) : trimmed).trim();\n if (!sig) continue;\n const name = sig.split(/\\s+/)[0]; // \"hello msg=...\" -> \"hello\"\n if (seen.has(name)) continue;\n seen.add(name);\n out.push({ name, description: hashIdx >= 0 ? trimmed.slice(hashIdx + 1).trim() : '' });\n }\n this.recipesCache = out;\n resolve(out);\n });\n });\n }\n\n subscribe(fn: (ev: JustEvent) => void): () => void {\n this.clients.add(fn);\n // 连上即重放:历史日志 + 当前状态\n for (const text of this.buffer) fn({ type: 'log', text });\n fn({ type: 'state', state: this.state, recipe: this.recipe, code: this.code });\n return () => this.clients.delete(fn);\n }\n\n private emit(ev: JustEvent) { for (const fn of this.clients) fn(ev); }\n\n info() { return { state: this.state, recipe: this.recipe, code: this.code }; }\n\n /** 启动 recipe(调用方须先用 recipes() 校验名字);自动停旧进程 */\n start(recipe: string) {\n this.killChild();\n this.recipe = recipe;\n this.code = null;\n this.state = 'running';\n this.buffer = [];\n this.pending = '';\n this.emit({ type: 'clear' }); // 广播清屏:已连接的订阅者同步清掉上一个任务的残留日志\n this.emit({ type: 'state', state: 'running', recipe, code: null });\n const child = spawn('just', [recipe], {\n cwd: this.cwd,\n shell: true,\n env: {\n ...process.env,\n FORCE_COLOR: '1', // node 生态(chalk 等)\n // maven 检测非 tty 会关颜色;经 MAVEN_OPTS 强制开(保留用户已有值)\n MAVEN_OPTS: `${process.env.MAVEN_OPTS ?? ''} -Dstyle.color=always`.trim(),\n CI: '',\n },\n });\n this.child = child;\n const push = (d: Buffer) => {\n this.pending += d.toString();\n let idx: number;\n while ((idx = this.pending.indexOf('\\n')) >= 0) {\n const line = this.pending.slice(0, idx + 1);\n this.pending = this.pending.slice(idx + 1);\n this.pushLine(line);\n }\n // 无 \\n 的尾巴留在 pending,等下个 chunk(块缓冲输出会在行中断开,不能当独立行)\n };\n child.stdout?.on('data', push);\n child.stderr?.on('data', push);\n child.on('error', (err) => { this.pushLine(`[zview] spawn error: ${err.message}\\n`); });\n child.on('exit', (code) => {\n if (this.pending) { this.pushLine(this.pending + '\\n'); this.pending = ''; } // flush 末尾无换行的残留\n this.child = null;\n this.state = 'exited';\n this.code = code ?? 0;\n this.emit({ type: 'state', state: 'exited', recipe: this.recipe, code: this.code });\n });\n }\n\n private pushLine(line: string) {\n this.buffer.push(line);\n if (this.buffer.length > MAX_BUFFER) this.buffer.shift();\n this.emit({ type: 'log', text: line });\n }\n\n stop() {\n this.killChild();\n }\n\n restart(recipe?: string) {\n const target = recipe ?? this.recipe;\n if (target) this.start(target);\n }\n\n private killChild() {\n const child = this.child;\n if (child?.pid) {\n try {\n if (process.platform === 'win32') spawn('taskkill', ['/PID', String(child.pid), '/T', '/F']);\n else child.kill('SIGTERM');\n } catch { /* 已退出 */ }\n }\n this.child = null;\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\n/** .zgoal/config.yaml(zgoal skill 的禅道凭据配置,扁平 key: value) */\nexport interface ZgoalConfig {\n url: string;\n account: string;\n password?: string;\n token?: string;\n product: number;\n}\n\nexport interface ZenBug {\n id: number;\n title: string;\n severity: number | string;\n pri: number | string;\n status: string;\n assignedTo: string;\n openedBy?: string;\n /** 指派给 config.account 的本人 */\n mine: boolean;\n}\n\nexport type BugsResult =\n | { ok: true; url: string; total: number; bugs: ZenBug[] }\n | { ok: false; error: string };\n\n/** 极简扁平 yaml 解析(仅 key: value 行,够 .zgoal/config.yaml 用) */\nfunction loadZgoalConfig(root: string): ZgoalConfig | null {\n const file = path.join(root, '.zgoal', 'config.yaml');\n if (!fs.existsSync(file)) return null;\n const kv: Record<string, string> = {};\n for (const line of fs.readFileSync(file, 'utf8').split('\\n')) {\n const m = line.match(/^\\s*([A-Za-z_]\\w*)\\s*:\\s*(.+?)\\s*$/);\n if (m && !m[2].startsWith('#')) kv[m[1]] = m[2].replace(/^[\"']|[\"']$/g, '');\n }\n const product = Number(kv.product);\n if (!kv.url || !product) return null;\n return {\n url: kv.url.replace(/\\/+$/, ''),\n account: kv.account ?? '',\n password: kv.password,\n token: kv.token,\n product,\n };\n}\n\nasync function fetchJson(url: string, init?: RequestInit): Promise<Record<string, unknown>> {\n const ctrl = new AbortController();\n const timer = setTimeout(() => ctrl.abort(), 8000);\n try {\n const res = await fetch(url, { ...init, signal: ctrl.signal });\n const text = await res.text();\n let json: Record<string, unknown> = {};\n try { json = JSON.parse(text); } catch { /* 非 JSON 当空 */ }\n if (!res.ok) {\n const err = json.error;\n throw new Error(`HTTP ${res.status}${typeof err === 'string' ? `: ${err}` : ''}`);\n }\n return json;\n } finally {\n clearTimeout(timer);\n }\n}\n\nlet tokenCache: { key: string; token: string; at: number } | null = null;\n\nasync function getToken(cfg: ZgoalConfig): Promise<string> {\n if (cfg.token) return cfg.token;\n const key = `${cfg.url}|${cfg.account}|${cfg.password ?? ''}`;\n if (tokenCache && tokenCache.key === key && Date.now() - tokenCache.at < 10 * 60_000) return tokenCache.token;\n const json = await fetchJson(`${cfg.url}/api.php/v1/tokens`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ account: cfg.account, password: cfg.password }),\n });\n const token = typeof json.token === 'string' ? json.token : '';\n if (!token) throw new Error('token 获取失败:检查 account / password');\n tokenCache = { key, token, at: Date.now() };\n return token;\n}\n\nfunction normBug(b: Record<string, unknown>, account: string): ZenBug {\n const assigned = b.assignedTo;\n const assignedTo =\n typeof assigned === 'string'\n ? assigned\n : assigned && typeof assigned === 'object' && 'realname' in (assigned as Record<string, unknown>)\n ? String((assigned as Record<string, unknown>).realname ?? '')\n : '';\n const assignedAccount =\n typeof assigned === 'string'\n ? assigned\n : assigned && typeof assigned === 'object'\n ? String((assigned as Record<string, unknown>).account ?? '')\n : '';\n const mine = !!account && (assignedAccount === account || assignedTo === account);\n return {\n id: Number(b.id),\n title: String(b.title ?? ''),\n severity: (b.severity as number | string) ?? 4,\n pri: (b.pri as number | string) ?? 3,\n status: String(b.status ?? ''),\n assignedTo,\n openedBy: typeof b.openedBy === 'string' ? b.openedBy : undefined,\n mine,\n };\n}\n\n/** 只读拉取禅道 bug 列表(GET,绝不写)。失败返回 ok:false,不抛。 */\nexport async function fetchBugs(root: string): Promise<BugsResult> {\n const cfg = loadZgoalConfig(root);\n if (!cfg) return { ok: false, error: '.zgoal/config.yaml 缺失或 url/product 未配置(由 zgoal skill 创建)' };\n try {\n const token = await getToken(cfg);\n const json = await fetchJson(\n `${cfg.url}/api.php/v1/products/${cfg.product}/bugs?page=1&limit=100`,\n { headers: { Token: token } },\n );\n const raw = Array.isArray(json.bugs) ? (json.bugs as Record<string, unknown>[]) : [];\n return { ok: true, url: cfg.url, total: Number(json.total ?? raw.length), bugs: raw.map((b) => normBug(b, cfg.account)) };\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n return { ok: false, error: `禅道请求失败(${msg})——检查 url / 凭据 / 是否开启 RESTful API v1` };\n }\n}\n","/**\n * zdashboard plugin system\n *\n * Plugin contract:\n * {\n * mode: string; // unique mode identifier, e.g. 'bugs'\n * label: string; // human label, e.g. '禅道'\n * icon?: string; // optional emoji or icon name\n * viewer: () => Promise<{ default: React.ComponentType }>;\n * sidebar?: () => Promise<{ default: React.ComponentType }>;\n * apiRoutes?: Record<string, (req: http.IncomingMessage, res: http.ServerResponse, root: string) => void>;\n * }\n */\n\nimport http from 'node:http';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport interface DashboardPlugin {\n mode: string;\n label: string;\n icon?: string;\n viewer: () => Promise<{ default: React.ComponentType }>;\n sidebar?: () => Promise<{ default: React.ComponentType }>;\n apiRoutes?: Record<string, (req: http.IncomingMessage, res: http.ServerResponse, root: string) => void>;\n}\n\nexport interface PluginContext {\n root: string;\n appDir: string;\n}\n\nconst builtinPlugins = new Map<string, DashboardPlugin>();\n\nexport function registerBuiltin(plugin: DashboardPlugin) {\n builtinPlugins.set(plugin.mode, plugin);\n}\n\nexport function getBuiltin(mode: string): DashboardPlugin | undefined {\n return builtinPlugins.get(mode);\n}\n\nexport function allBuiltins(): DashboardPlugin[] {\n return Array.from(builtinPlugins.values());\n}\n\nexport async function loadExternalPlugins(pluginDirs: string[]): Promise<DashboardPlugin[]> {\n const plugins: DashboardPlugin[] = [];\n for (const dir of pluginDirs) {\n if (!fs.existsSync(dir)) continue;\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n const indexPath = path.join(dir, entry.name, 'index.ts');\n if (!fs.existsSync(indexPath)) continue;\n try {\n const mod = await import(path.join(dir, entry.name, 'index.ts'));\n const plugin = mod.default as DashboardPlugin;\n if (plugin?.mode) {\n plugins.push(plugin);\n }\n } catch (e) {\n console.error(`[zdashboard] failed to load plugin ${entry.name}:`, e);\n }\n }\n }\n return plugins;\n}\n","{\n \"name\": \"zdashboard\",\n \"version\": \"1.0.0\",\n \"description\": \"ZCode skill dashboard platform — pluggable viewers for zdesign/zview/zreview/zgoal\",\n \"type\": \"module\",\n \"bin\": { \"zdashboard\": \"./dist/cli.js\" },\n \"files\": [\"dist\"],\n \"publishConfig\": { \"access\": \"public\" },\n \"scripts\": {\n \"dev\": \"vite\",\n \"build\": \"tsup && vite build\",\n \"build:web\": \"vite build\",\n \"build:node\": \"tsup\",\n \"start\": \"node dist/cli.js\",\n \"preview\": \"vite preview\"\n },\n \"dependencies\": {\n \"@radix-ui/react-scroll-area\": \"^1.2.0\",\n \"@radix-ui/react-separator\": \"^1.1.0\",\n \"@radix-ui/react-slot\": \"^1.1.0\",\n \"@radix-ui/react-tooltip\": \"^1.1.2\",\n \"ansi-to-react\": \"^6.1.6\",\n \"class-variance-authority\": \"^0.7.0\",\n \"clsx\": \"^2.1.1\",\n \"highlight.js\": \"^11.11.1\",\n \"katex\": \"^0.16.11\",\n \"lucide-react\": \"^0.460.0\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"react-markdown\": \"^9.0.1\",\n \"remark-frontmatter\": \"^5.0.0\",\n \"remark-gfm\": \"^4.0.0\",\n \"remark-math\": \"^6.0.0\",\n \"rehype-autolink-headings\": \"^7.1.0\",\n \"rehype-highlight\": \"^7.0.1\",\n \"rehype-katex\": \"^7.0.1\",\n \"rehype-raw\": \"^7.0.0\",\n \"rehype-slug\": \"^6.0.0\",\n \"tailwind-merge\": \"^2.5.4\"\n },\n \"devDependencies\": {\n \"@tailwindcss/typography\": \"^0.5.20\",\n \"@types/node\": \"^22.9.0\",\n \"@types/react\": \"^18.3.12\",\n \"@types/react-dom\": \"^18.3.1\",\n \"typescript\": \"^5.6.3\",\n \"vite\": \"^5.4.10\",\n \"@vitejs/plugin-react\": \"^4.3.3\",\n \"tailwindcss\": \"^3.4.14\",\n \"tailwindcss-animate\": \"^1.0.7\",\n \"postcss\": \"^8.4.49\",\n \"autoprefixer\": \"^10.4.20\",\n \"tsup\": \"^8.3.5\"\n },\n \"pnpm\": {\n \"onlyBuiltDependencies\": [\"esbuild\"]\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { execFile } from 'node:child_process';\n\nexport interface DetectResult {\n hasOpenspec: boolean;\n hasDocs: boolean;\n hasJust: boolean;\n hasBugs: boolean;\n}\n\nfunction justAvailable(cwd: string): Promise<boolean> {\n return new Promise((resolve) => {\n const child = execFile('just', ['--list', '--unsorted'], { cwd, timeout: 5000 }, (err) => {\n resolve(!err);\n });\n if (child.killed) resolve(false);\n });\n}\n\nexport async function detect(root: string): Promise<DetectResult> {\n const hasOpenspec = fs.existsSync(path.join(root, 'openspec'));\n const hasDocs = fs.existsSync(path.join(root, 'docs'));\n const hasJust = await justAvailable(root);\n const hasBugs = fs.existsSync(path.join(root, '.zgoal', 'config.yaml'));\n return { hasOpenspec, hasDocs, hasJust, hasBugs };\n}\n","import { createServer } from './server/index.js';\nimport { detect } from './server/detect.js';\n\nfunction parseArgs(a: string[]): Record<string, string | true> {\n const o: Record<string, string | true> = {};\n for (let i = 0; i < a.length; i++) {\n if (a[i].indexOf('--') === 0) {\n const n = a[i + 1];\n o[a[i].slice(2)] = n && n.indexOf('--') !== 0 ? a[++i] : true;\n }\n }\n return o;\n}\n\nconst args = parseArgs(process.argv.slice(2));\nconst root = (args.dir as string) ?? '.';\n\nconst det = await detect(root);\ncreateServer({\n root,\n port: args.port ? parseInt(args.port as string, 10) : undefined,\n open: !!args.open,\n detect: det,\n mode: args.mode as string | undefined,\n});\n"],"mappings":";;;AAAA,OAAO,UAAU;AACjB,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,OAAO,YAAY;AACnB,SAAS,YAAY;AACrB,SAAS,iBAAAC,sBAAqB;;;ACL9B,OAAO,QAAQ;AACf,OAAO,UAAU;AAWjB,SAAS,UAAU,QAAgB,QAAgB,QAAQ,GAAe;AACxE,MAAI,QAAQ,EAAG,QAAO,CAAC;AACvB,MAAI;AACJ,MAAI;AAAE,WAAO,GAAG,YAAY,QAAQ,EAAE,eAAe,KAAK,CAAC;AAAA,EAAG,QAAQ;AAAE,WAAO,CAAC;AAAA,EAAG;AACnF,QAAM,QAAoB,CAAC;AAC3B,aAAW,OAAO,MAAM;AACtB,QAAI,IAAI,KAAK,WAAW,GAAG,KAAK,IAAI,SAAS,eAAgB;AAC7D,UAAM,MAAM,SAAS,GAAG,MAAM,IAAI,IAAI,IAAI,KAAK,IAAI;AACnD,QAAI,IAAI,YAAY,GAAG;AACrB,YAAM,KAAK,EAAE,MAAM,IAAI,MAAM,MAAM,OAAO,UAAU,UAAU,KAAK,KAAK,QAAQ,IAAI,IAAI,GAAG,KAAK,QAAQ,CAAC,EAAE,CAAC;AAAA,IAC9G,OAAO;AACL,YAAM,KAAK,EAAE,MAAM,IAAI,MAAM,MAAM,QAAQ,MAAM,IAAI,CAAC;AAAA,IACxD;AAAA,EACF;AACA,QAAM,KAAK,CAAC,GAAG,MAAO,EAAE,SA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H,IAAG,WAAWC,MAAK,KAAKE,OAAM,MAAM,CAAC;AACrD,QAAM,UAAU,MAAM,cAAcA,KAAI;AACxC,QAAM,UAAUH,IAAG,WAAWC,MAAK,KAAKE,OAAM,UAAU,aAAa,CAAC;AACtE,SAAO,EAAE,aAAa,SAAS,SAAS,QAAQ;AAClD;;;ACvBA,SAAS,UAAU,GAA4C;AAC7D,QAAM,IAAmC,CAAC;AAC1C,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;AACjC,QAAI,EAAE,CAAC,EAAE,QAAQ,IAAI,MAAM,GAAG;AAC5B,YAAM,IAAI,EAAE,IAAI,CAAC;AACjB,QAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,KAAK,EAAE,QAAQ,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC,IAAI;AAAA,IAC3D;AAAA,EACF;AACA,SAAO;AACT;AAEA,IAAM,OAAO,UAAU,QAAQ,KAAK,MAAM,CAAC,CAAC;AAC5C,IAAM,OAAQ,KAAK,OAAkB;AAErC,IAAM,MAAM,MAAM,OAAO,IAAI;AAC7B,aAAa;AAAA,EACX;AAAA,EACA,MAAM,KAAK,OAAO,SAAS,KAAK,MAAgB,EAAE,IAAI;AAAA,EACtD,MAAM,CAAC,CAAC,KAAK;AAAA,EACb,QAAQ;AAAA,EACR,MAAM,KAAK;AACb,CAAC;","names":["fs","path","fileURLToPath","root","fs","path","root","fs","path","__dirname","path","fileURLToPath","fs","det","handler","fp","fs","path","execFile","root"]}
1
+ {"version":3,"sources":["../src/server/index.ts","../src/server/spec-scan.ts","../src/server/just-runner.ts","../src/server/bugs.ts","../src/server/plugins.ts","../package.json","../src/server/detect.ts","../src/cli.ts"],"sourcesContent":["import http from 'node:http';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport crypto from 'node:crypto';\nimport { exec } from 'node:child_process';\nimport { fileURLToPath } from 'node:url';\nimport { scanTree } from './spec-scan.js';\nimport { JustRunner } from './just-runner.js';\nimport { fetchBugs } from './bugs.js';\nimport { registerBuiltin, allBuiltins, type DashboardPlugin } from './plugins.js';\nimport type { DetectResult } from './detect.js';\nimport pkg from '../../package.json' with { type: 'json' };\n\nconst VERSION = pkg.version;\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst STOP_TOKEN = crypto.randomBytes(12).toString('hex');\nconst INJECT = `<script>(function(){try{var es=new EventSource('/__reload');es.addEventListener('reload',function(){location.reload();});es.onerror=function(){es.close();};}catch(e){}document.addEventListener('click',function(e){var t=e.target;if(t&&t.closest){var a=t.closest('a[target]');if(a&&a.target!=='_self'){a.target='_self';}}},true);})();</script>`;\n\nconst MIME: Record<string, string> = {\n '.html': 'text/html; charset=utf-8', '.htm': 'text/html; charset=utf-8',\n '.css': 'text/css; charset=utf-8', '.js': 'application/javascript; charset=utf-8',\n '.mjs': 'application/javascript; charset=utf-8', '.json': 'application/json; charset=utf-8',\n '.svg': 'image/svg+xml', '.png': 'image/png', '.ico': 'image/x-icon',\n '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.gif': 'image/gif', '.webp': 'image/webp',\n '.md': 'text/markdown; charset=utf-8', '.txt': 'text/plain; charset=utf-8',\n '.yml': 'text/yaml; charset=utf-8', '.yaml': 'text/yaml; charset=utf-8',\n '.woff': 'font/woff', '.woff2': 'font/woff2', '.ttf': 'font/ttf',\n '.map': 'application/json; charset=utf-8',\n};\n\nexport interface ServerOptions {\n root: string;\n port?: number;\n open?: boolean;\n detect: DetectResult;\n dashboardDir?: string;\n mode?: string;\n}\n\nfunction readBody(req: http.IncomingMessage): Promise<string> {\n return new Promise((resolve) => {\n let data = '';\n req.on('data', (c) => (data += c));\n req.on('end', () => resolve(data));\n });\n}\n\nexport function createServer(opts: ServerOptions) {\n const ROOT = path.resolve(opts.root);\n const PORT0 = opts.port ?? 4190;\n const OPEN = !!opts.open;\n const APP_DIR = opts.dashboardDir ?? path.resolve(__dirname, 'web');\n if (!fs.existsSync(ROOT)) fs.mkdirSync(ROOT, { recursive: true });\n const det = opts.detect;\n const runner = new JustRunner(ROOT);\n const MODE = opts.mode;\n\n // register builtin plugins (server-side: apiRoutes only; viewer loaded by frontend)\n registerBuiltin({\n mode: 'bugs', label: '禅道 Bugs', icon: '🎯',\n apiRoutes: { '/__bugs': async (_, res) => { res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache' }); fetchBugs(ROOT).then((r) => res.end(JSON.stringify(r))); } }\n });\n registerBuiltin({ mode: 'view', label: '项目浏览', icon: '👁️' });\n registerBuiltin({ mode: 'review', label: '文档评审', icon: '✅' });\n\n const clients = new Set<http.ServerResponse>();\n const broadcast = (ev: string, data: unknown = '') => {\n const payload = `event: ${ev}\\ndata: ${JSON.stringify(data == null ? '' : data)}\\n\\n`;\n for (const c of clients) c.write(payload);\n };\n\n function serveFile(filePath: string, res: http.ServerResponse, injectHtml: boolean) {\n fs.readFile(filePath, (err, data) => {\n if (err) { res.writeHead(404); return res.end('Not found'); }\n const ext = path.extname(filePath).toLowerCase();\n const ct = MIME[ext] ?? 'application/octet-stream';\n let body = data;\n if (injectHtml && ext === '.html') {\n const s = data.toString('utf8');\n body = Buffer.from(s.indexOf('</body>') >= 0 ? s.replace('</body>', INJECT + '</body>') : s + INJECT);\n }\n res.writeHead(200, { 'Content-Type': ct, 'Cache-Control': 'no-cache' });\n res.end(body);\n });\n }\n\n function handler(req: http.IncomingMessage, res: http.ServerResponse) {\n const url = req.url!.split('?')[0];\n\n // ── SSE:文件变更 ──\n if (url === '/__reload') {\n res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', Connection: 'keep-alive' });\n res.write(': connected\\n\\n');\n clients.add(res);\n req.on('close', () => clients.delete(res));\n return;\n }\n if (url === '/__config') {\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache' });\n return res.end(JSON.stringify({ stopToken: STOP_TOKEN }));\n }\n if (url === '/__stop' && req.method === 'POST') {\n if (req.headers['x-stop-token'] === STOP_TOKEN) {\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });\n res.end('{\"ok\":true}');\n runner.stop();\n setTimeout(() => { try { server.close(); } catch {} process.exit(0); }, 50);\n } else { res.writeHead(403); res.end('forbidden'); }\n return;\n }\n\n // ── 方案模式:树形文件清单(+探测结果) ──\n if (url === '/__files') {\n const tree = scanTree(ROOT, det.hasOpenspec, det.hasDocs);\n const payload: TreeNodePayload = { tree, ...det };\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache' });\n return res.end(JSON.stringify(payload));\n }\n\n // ── 日志能力 ──\n if (url === '/__just/recipes') {\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache' });\n runner.recipes().then((r) => res.end(JSON.stringify(r)));\n return;\n }\n if (url === '/__just/logs') {\n res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', Connection: 'keep-alive' });\n res.write(': connected\\n\\n');\n const unsub = runner.subscribe((ev) => res.write(`data: ${JSON.stringify(ev)}\\n\\n`));\n req.on('close', unsub);\n return;\n }\n const justAction = url.match(/^\\/__just\\/(start|stop|restart)$/);\n if (justAction && req.method === 'POST') {\n (async () => {\n if (req.headers['x-stop-token'] !== STOP_TOKEN) { res.writeHead(403); res.end('forbidden'); return; }\n const body = await readBody(req);\n let recipe: string | undefined;\n try { recipe = JSON.parse(body || '{}').recipe; } catch { /* ignore */ }\n const act = justAction[1];\n if (act === 'start' || act === 'restart') {\n const target = recipe ?? runner.info().recipe;\n if (!target) { res.writeHead(400); res.end('{\"error\":\"no recipe\"}'); return; }\n const recipes = await runner.recipes();\n if (!recipes.some((r) => r.name === target)) { res.writeHead(403); res.end('{\"error\":\"unknown recipe\"}'); return; }\n runner.start(target);\n } else {\n runner.stop();\n }\n res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });\n res.end(JSON.stringify(runner.info()));\n })();\n return;\n }\n\n // ── plugin API routes ──\n let handled = false;\n for (const plugin of allBuiltins()) {\n if (!plugin.apiRoutes) continue;\n for (const [route, handler] of Object.entries(plugin.apiRoutes)) {\n if (url === route) {\n handled = true;\n handler(req, res, ROOT);\n return;\n }\n }\n }\n\n // ── dashboard 前端 ──\n if (url === '/') return serveFile(path.join(APP_DIR, 'index.html'), res, false);\n if (url.indexOf('/__app/') === 0) {\n const fp = path.join(APP_DIR, url.slice(7));\n if (fp !== APP_DIR && fp.indexOf(APP_DIR + path.sep) !== 0) { res.writeHead(403); return res.end('Forbidden'); }\n return serveFile(fp, res, false);\n }\n if (url.indexOf('/assets/') === 0) {\n const fp = path.join(APP_DIR, decodeURIComponent(url));\n if (fp.indexOf(APP_DIR + path.sep) !== 0) { res.writeHead(403); return res.end('Forbidden'); }\n return serveFile(fp, res, false);\n }\n\n // ── 用户资产 ──\n const fp = path.join(ROOT, decodeURIComponent(url));\n if (fp !== ROOT && fp.indexOf(ROOT + path.sep) !== 0) { res.writeHead(403); return res.end('Forbidden'); }\n return serveFile(fp, res, true);\n }\n\n let server: http.Server;\n function start(port: number) {\n server = http.createServer(handler);\n server.on('error', (err: NodeJS.ErrnoException) => {\n if (err.code === 'EADDRINUSE') { console.log(`[zdashboard] port ${port} busy, trying ${port + 1}`); start(port + 1); }\n else throw err;\n });\n server.listen(port, () => {\n const u = `http://localhost:${port}`;\n console.log(`[zdashboard] v${VERSION} dashboard -> ${u}`);\n console.log(`[zdashboard] project -> ${ROOT}`);\n console.log(`[zdashboard] mode -> ${MODE ?? '(auto)'}`);\n console.log(`[zdashboard] detect -> openspec:${det.hasOpenspec} docs:${det.hasDocs} just:${det.hasJust} bugs:${det.hasBugs}`);\n if (OPEN) exec(process.platform === 'darwin' ? `open ${u}` : `start ${u}`);\n });\n }\n\n let debounce: NodeJS.Timeout;\n try {\n fs.watch(ROOT, { recursive: true }, () => {\n clearTimeout(debounce);\n debounce = setTimeout(() => {\n broadcast('reload');\n broadcast('files');\n console.log(`[zdashboard] change -> reload + refresh tree (${clients.size} client${clients.size === 1 ? '' : 's'})`);\n }, 150);\n });\n } catch { console.log('[zdashboard] watch unavailable - static only.'); }\n\n start(PORT0);\n}\n\ninterface TreeNodePayload { tree: unknown; hasOpenspec: boolean; hasDocs: boolean; hasJust: boolean; hasBugs: boolean; }\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nexport type NodeKind = 'file' | 'dir' | 'log';\nexport interface TreeNode {\n name: string;\n kind: NodeKind;\n path?: string; // file: 相对 root 的路径(点击预览用)\n defaultCollapsed?: boolean;\n children?: TreeNode[];\n}\n\nfunction walkFiles(absDir: string, relDir: string, depth = 0): TreeNode[] {\n if (depth > 4) return [];\n let ents: fs.Dirent[];\n try { ents = fs.readdirSync(absDir, { withFileTypes: true }); } catch { return []; }\n const nodes: TreeNode[] = [];\n for (const ent of ents) {\n if (ent.name.startsWith('.') || ent.name === 'node_modules') continue;\n const rel = relDir ? `${relDir}/${ent.name}` : ent.name;\n if (ent.isDirectory()) {\n nodes.push({ name: ent.name, kind: 'dir', children: walkFiles(path.join(absDir, ent.name), rel, depth + 1) });\n } else {\n nodes.push({ name: ent.name, kind: 'file', path: rel });\n }\n }\n nodes.sort((a, b) => (a.kind === b.kind ? a.name.localeCompare(b.name) : a.kind === 'dir' ? -1 : 1));\n return nodes;\n}\n\n/** 方案模式树形扫描:openspec 感知 + docs 聚合 + 其他兜底 */\nexport function scanTree(root: string, hasOpenspec: boolean, hasDocs: boolean): TreeNode[] {\n const tree: TreeNode[] = [];\n if (hasOpenspec && fs.existsSync(path.join(root, 'openspec', 'changes'))) {\n const changesDir = path.join(root, 'openspec', 'changes');\n const active: TreeNode[] = [];\n const archived: TreeNode[] = [];\n for (const ent of fs.readdirSync(changesDir, { withFileTypes: true })) {\n if (!ent.isDirectory() || ent.name.startsWith('.') || ent.name === 'archive') continue;\n active.push({ name: ent.name, kind: 'dir', children: walkFiles(path.join(changesDir, ent.name), `openspec/changes/${ent.name}`) });\n }\n active.sort((a, b) => a.name.localeCompare(b.name));\n const archiveDir = path.join(changesDir, 'archive');\n if (fs.existsSync(archiveDir)) {\n for (const ent of fs.readdirSync(archiveDir, { withFileTypes: true })) {\n if (!ent.isDirectory() || ent.name.startsWith('.')) continue;\n archived.push({ name: ent.name, kind: 'dir', children: walkFiles(path.join(archiveDir, ent.name), `openspec/changes/archive/${ent.name}`) });\n }\n archived.sort((a, b) => b.name.localeCompare(a.name)); // 日期前缀倒序\n }\n if (active.length) tree.push({ name: `进行中 (${active.length})`, kind: 'dir', children: active });\n if (archived.length) tree.push({ name: `归档 (${archived.length})`, kind: 'dir', defaultCollapsed: true, children: archived });\n const specsDir = path.join(root, 'openspec', 'specs');\n if (fs.existsSync(specsDir)) {\n const specs = walkFiles(specsDir, 'openspec/specs');\n if (specs.length) tree.push({ name: '能力 Specs', kind: 'dir', children: specs });\n }\n }\n if (hasDocs && fs.existsSync(path.join(root, 'docs'))) {\n const docs = walkFiles(path.join(root, 'docs'), 'docs');\n if (docs.length) tree.push({ name: 'docs', kind: 'dir', children: docs });\n }\n const skip = new Set(['openspec', 'docs', 'node_modules', '.git', 'dist', 'test-server']);\n // \"其他\"只收根目录的 md 文档(README/CLAUDE 等);构建配置(pom.xml/justfile 等)不收——对\"方案+日志\"定位是噪音\n const etc: TreeNode[] = [];\n try {\n for (const ent of fs.readdirSync(root, { withFileTypes: true })) {\n if (ent.name.startsWith('.') || skip.has(ent.name)) continue;\n const ext = path.extname(ent.name).toLowerCase();\n if (ent.isFile() && (ext === '.md' || ext === '.markdown')) etc.push({ name: ent.name, kind: 'file', path: ent.name });\n }\n } catch {}\n etc.sort((a, b) => a.name.localeCompare(b.name));\n if (etc.length) tree.push({ name: `其他 (${etc.length})`, kind: 'dir', children: etc });\n return tree;\n}\n","import { spawn, execFile, type ChildProcess } from 'node:child_process';\n\nexport interface Recipe { name: string; description: string; }\nexport type JustState = 'idle' | 'running' | 'exited';\nexport type JustEvent =\n | { type: 'log'; text: string }\n | { type: 'clear' }\n | { type: 'state'; state: JustState; recipe: string | null; code: number | null };\n\nconst MAX_BUFFER = 1000;\n\nexport class JustRunner {\n private cwd: string;\n private child: ChildProcess | null = null;\n private recipe: string | null = null;\n private state: JustState = 'idle';\n private code: number | null = null;\n private buffer: string[] = [];\n private pending = ''; // 行缓冲:块缓冲输出(如 maven)的 chunk 会在行中间断开,攒到 \\n 才切行\n private clients = new Set<(ev: JustEvent) => void>();\n private recipesCache: Recipe[] | null = null;\n\n constructor(cwd: string) { this.cwd = cwd; }\n\n recipes(): Promise<Recipe[]> {\n if (this.recipesCache) return Promise.resolve(this.recipesCache);\n return new Promise((resolve) => {\n execFile('just', ['--list', '--unsorted'], { cwd: this.cwd, maxBuffer: 1 << 20, timeout: 8000 }, (err, stdout) => {\n if (err) { resolve([]); return; }\n const out: Recipe[] = [];\n const seen = new Set<string>();\n for (const line of stdout.split(/\\r?\\n/).slice(1)) { // 跳过 \"Available recipes:\"\n const trimmed = line.trim();\n if (!trimmed) continue;\n const hashIdx = trimmed.indexOf('#');\n const sig = (hashIdx >= 0 ? trimmed.slice(0, hashIdx) : trimmed).trim();\n if (!sig) continue;\n const name = sig.split(/\\s+/)[0]; // \"hello msg=...\" -> \"hello\"\n if (seen.has(name)) continue;\n seen.add(name);\n out.push({ name, description: hashIdx >= 0 ? trimmed.slice(hashIdx + 1).trim() : '' });\n }\n this.recipesCache = out;\n resolve(out);\n });\n });\n }\n\n subscribe(fn: (ev: JustEvent) => void): () => void {\n this.clients.add(fn);\n // 连上即重放:历史日志 + 当前状态\n for (const text of this.buffer) fn({ type: 'log', text });\n fn({ type: 'state', state: this.state, recipe: this.recipe, code: this.code });\n return () => this.clients.delete(fn);\n }\n\n private emit(ev: JustEvent) { for (const fn of this.clients) fn(ev); }\n\n info() { return { state: this.state, recipe: this.recipe, code: this.code }; }\n\n /** 启动 recipe(调用方须先用 recipes() 校验名字);自动停旧进程 */\n start(recipe: string) {\n this.killChild();\n this.recipe = recipe;\n this.code = null;\n this.state = 'running';\n this.buffer = [];\n this.pending = '';\n this.emit({ type: 'clear' }); // 广播清屏:已连接的订阅者同步清掉上一个任务的残留日志\n this.emit({ type: 'state', state: 'running', recipe, code: null });\n const child = spawn('just', [recipe], {\n cwd: this.cwd,\n shell: true,\n env: {\n ...process.env,\n FORCE_COLOR: '1', // node 生态(chalk 等)\n // maven 检测非 tty 会关颜色;经 MAVEN_OPTS 强制开(保留用户已有值)\n MAVEN_OPTS: `${process.env.MAVEN_OPTS ?? ''} -Dstyle.color=always`.trim(),\n CI: '',\n },\n });\n this.child = child;\n const push = (d: Buffer) => {\n this.pending += d.toString();\n let idx: number;\n while ((idx = this.pending.indexOf('\\n')) >= 0) {\n const line = this.pending.slice(0, idx + 1);\n this.pending = this.pending.slice(idx + 1);\n this.pushLine(line);\n }\n // 无 \\n 的尾巴留在 pending,等下个 chunk(块缓冲输出会在行中断开,不能当独立行)\n };\n child.stdout?.on('data', push);\n child.stderr?.on('data', push);\n child.on('error', (err) => { this.pushLine(`[zview] spawn error: ${err.message}\\n`); });\n child.on('exit', (code) => {\n if (this.pending) { this.pushLine(this.pending + '\\n'); this.pending = ''; } // flush 末尾无换行的残留\n this.child = null;\n this.state = 'exited';\n this.code = code ?? 0;\n this.emit({ type: 'state', state: 'exited', recipe: this.recipe, code: this.code });\n });\n }\n\n private pushLine(line: string) {\n this.buffer.push(line);\n if (this.buffer.length > MAX_BUFFER) this.buffer.shift();\n this.emit({ type: 'log', text: line });\n }\n\n stop() {\n this.killChild();\n }\n\n restart(recipe?: string) {\n const target = recipe ?? this.recipe;\n if (target) this.start(target);\n }\n\n private killChild() {\n const child = this.child;\n if (child?.pid) {\n try {\n if (process.platform === 'win32') spawn('taskkill', ['/PID', String(child.pid), '/T', '/F']);\n else child.kill('SIGTERM');\n } catch { /* 已退出 */ }\n }\n this.child = null;\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\n/** .zgoal/config.yaml(zgoal skill 的禅道凭据配置,扁平 key: value) */\nexport interface ZgoalConfig {\n url: string;\n account: string;\n password?: string;\n token?: string;\n product: number;\n}\n\nexport interface ZenBug {\n id: number;\n title: string;\n severity: number | string;\n pri: number | string;\n status: string;\n assignedTo: string;\n openedBy?: string;\n /** 指派给 config.account 的本人 */\n mine: boolean;\n}\n\nexport type BugsResult =\n | { ok: true; url: string; total: number; bugs: ZenBug[] }\n | { ok: false; error: string };\n\n/** 极简扁平 yaml 解析(仅 key: value 行,够 .zgoal/config.yaml 用) */\nfunction loadZgoalConfig(root: string): ZgoalConfig | null {\n const file = path.join(root, '.zgoal', 'config.yaml');\n if (!fs.existsSync(file)) return null;\n const kv: Record<string, string> = {};\n for (const line of fs.readFileSync(file, 'utf8').split('\\n')) {\n const m = line.match(/^\\s*([A-Za-z_]\\w*)\\s*:\\s*(.+?)\\s*$/);\n if (m && !m[2].startsWith('#')) kv[m[1]] = m[2].replace(/^[\"']|[\"']$/g, '');\n }\n const product = Number(kv.product);\n if (!kv.url || !product) return null;\n return {\n url: kv.url.replace(/\\/+$/, ''),\n account: kv.account ?? '',\n password: kv.password,\n token: kv.token,\n product,\n };\n}\n\nasync function fetchJson(url: string, init?: RequestInit): Promise<Record<string, unknown>> {\n const ctrl = new AbortController();\n const timer = setTimeout(() => ctrl.abort(), 8000);\n try {\n const res = await fetch(url, { ...init, signal: ctrl.signal });\n const text = await res.text();\n let json: Record<string, unknown> = {};\n try { json = JSON.parse(text); } catch { /* 非 JSON 当空 */ }\n if (!res.ok) {\n const err = json.error;\n throw new Error(`HTTP ${res.status}${typeof err === 'string' ? `: ${err}` : ''}`);\n }\n return json;\n } finally {\n clearTimeout(timer);\n }\n}\n\nlet tokenCache: { key: string; token: string; at: number } | null = null;\n\nasync function getToken(cfg: ZgoalConfig): Promise<string> {\n if (cfg.token) return cfg.token;\n const key = `${cfg.url}|${cfg.account}|${cfg.password ?? ''}`;\n if (tokenCache && tokenCache.key === key && Date.now() - tokenCache.at < 10 * 60_000) return tokenCache.token;\n const json = await fetchJson(`${cfg.url}/api.php/v1/tokens`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ account: cfg.account, password: cfg.password }),\n });\n const token = typeof json.token === 'string' ? json.token : '';\n if (!token) throw new Error('token 获取失败:检查 account / password');\n tokenCache = { key, token, at: Date.now() };\n return token;\n}\n\nfunction normBug(b: Record<string, unknown>, account: string): ZenBug {\n const assigned = b.assignedTo;\n const assignedTo =\n typeof assigned === 'string'\n ? assigned\n : assigned && typeof assigned === 'object' && 'realname' in (assigned as Record<string, unknown>)\n ? String((assigned as Record<string, unknown>).realname ?? '')\n : '';\n const assignedAccount =\n typeof assigned === 'string'\n ? assigned\n : assigned && typeof assigned === 'object'\n ? String((assigned as Record<string, unknown>).account ?? '')\n : '';\n const mine = !!account && (assignedAccount === account || assignedTo === account);\n return {\n id: Number(b.id),\n title: String(b.title ?? ''),\n severity: (b.severity as number | string) ?? 4,\n pri: (b.pri as number | string) ?? 3,\n status: String(b.status ?? ''),\n assignedTo,\n openedBy: typeof b.openedBy === 'string' ? b.openedBy : undefined,\n mine,\n };\n}\n\n/** 只读拉取禅道 bug 列表(GET,绝不写)。失败返回 ok:false,不抛。 */\nexport async function fetchBugs(root: string): Promise<BugsResult> {\n const cfg = loadZgoalConfig(root);\n if (!cfg) return { ok: false, error: '.zgoal/config.yaml 缺失或 url/product 未配置(由 zgoal skill 创建)' };\n try {\n const token = await getToken(cfg);\n const json = await fetchJson(\n `${cfg.url}/api.php/v1/products/${cfg.product}/bugs?page=1&limit=100`,\n { headers: { Token: token } },\n );\n const raw = Array.isArray(json.bugs) ? (json.bugs as Record<string, unknown>[]) : [];\n return { ok: true, url: cfg.url, total: Number(json.total ?? raw.length), bugs: raw.map((b) => normBug(b, cfg.account)) };\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n return { ok: false, error: `禅道请求失败(${msg})——检查 url / 凭据 / 是否开启 RESTful API v1` };\n }\n}\n","/**\n * zdashboard plugin system\n *\n * Plugin contract:\n * {\n * mode: string; // unique mode identifier, e.g. 'bugs'\n * label: string; // human label, e.g. '禅道'\n * icon?: string; // optional emoji or icon name\n * viewer: () => Promise<{ default: React.ComponentType }>;\n * sidebar?: () => Promise<{ default: React.ComponentType }>;\n * apiRoutes?: Record<string, (req: http.IncomingMessage, res: http.ServerResponse, root: string) => void>;\n * }\n */\n\nimport http from 'node:http';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport interface DashboardPlugin {\n mode: string;\n label: string;\n icon?: string;\n viewer: () => Promise<{ default: React.ComponentType }>;\n sidebar?: () => Promise<{ default: React.ComponentType }>;\n apiRoutes?: Record<string, (req: http.IncomingMessage, res: http.ServerResponse, root: string) => void>;\n}\n\nexport interface PluginContext {\n root: string;\n appDir: string;\n}\n\nconst builtinPlugins = new Map<string, DashboardPlugin>();\n\nexport function registerBuiltin(plugin: DashboardPlugin) {\n builtinPlugins.set(plugin.mode, plugin);\n}\n\nexport function getBuiltin(mode: string): DashboardPlugin | undefined {\n return builtinPlugins.get(mode);\n}\n\nexport function allBuiltins(): DashboardPlugin[] {\n return Array.from(builtinPlugins.values());\n}\n\nexport async function loadExternalPlugins(pluginDirs: string[]): Promise<DashboardPlugin[]> {\n const plugins: DashboardPlugin[] = [];\n for (const dir of pluginDirs) {\n if (!fs.existsSync(dir)) continue;\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n const indexPath = path.join(dir, entry.name, 'index.ts');\n if (!fs.existsSync(indexPath)) continue;\n try {\n const mod = await import(path.join(dir, entry.name, 'index.ts'));\n const plugin = mod.default as DashboardPlugin;\n if (plugin?.mode) {\n plugins.push(plugin);\n }\n } catch (e) {\n console.error(`[zdashboard] failed to load plugin ${entry.name}:`, e);\n }\n }\n }\n return plugins;\n}\n","{\n \"name\": \"zdashboard\",\n \"version\": \"1.0.1\",\n \"description\": \"ZCode skill dashboard platform — pluggable viewers for zdesign/zview/zreview/zgoal\",\n \"type\": \"module\",\n \"bin\": { \"zdashboard\": \"./dist/cli.js\" },\n \"files\": [\"dist\"],\n \"publishConfig\": { \"access\": \"public\" },\n \"scripts\": {\n \"dev\": \"vite\",\n \"build\": \"tsup && vite build\",\n \"build:web\": \"vite build\",\n \"build:node\": \"tsup\",\n \"start\": \"node dist/cli.js\",\n \"preview\": \"vite preview\"\n },\n \"dependencies\": {\n \"@radix-ui/react-scroll-area\": \"^1.2.0\",\n \"@radix-ui/react-separator\": \"^1.1.0\",\n \"@radix-ui/react-slot\": \"^1.1.0\",\n \"@radix-ui/react-tooltip\": \"^1.1.2\",\n \"ansi-to-react\": \"^6.1.6\",\n \"class-variance-authority\": \"^0.7.0\",\n \"clsx\": \"^2.1.1\",\n \"highlight.js\": \"^11.11.1\",\n \"katex\": \"^0.16.11\",\n \"lucide-react\": \"^0.460.0\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"react-markdown\": \"^9.0.1\",\n \"remark-frontmatter\": \"^5.0.0\",\n \"remark-gfm\": \"^4.0.0\",\n \"remark-math\": \"^6.0.0\",\n \"rehype-autolink-headings\": \"^7.1.0\",\n \"rehype-highlight\": \"^7.0.1\",\n \"rehype-katex\": \"^7.0.1\",\n \"rehype-raw\": \"^7.0.0\",\n \"rehype-slug\": \"^6.0.0\",\n \"tailwind-merge\": \"^2.5.4\"\n },\n \"devDependencies\": {\n \"@tailwindcss/typography\": \"^0.5.20\",\n \"@types/node\": \"^22.9.0\",\n \"@types/react\": \"^18.3.12\",\n \"@types/react-dom\": \"^18.3.1\",\n \"typescript\": \"^5.6.3\",\n \"vite\": \"^5.4.10\",\n \"@vitejs/plugin-react\": \"^4.3.3\",\n \"tailwindcss\": \"^3.4.14\",\n \"tailwindcss-animate\": \"^1.0.7\",\n \"postcss\": \"^8.4.49\",\n \"autoprefixer\": \"^10.4.20\",\n \"tsup\": \"^8.3.5\"\n },\n \"pnpm\": {\n \"onlyBuiltDependencies\": [\"esbuild\"]\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { execFile } from 'node:child_process';\n\nexport interface DetectResult {\n hasOpenspec: boolean;\n hasDocs: boolean;\n hasJust: boolean;\n hasBugs: boolean;\n}\n\nfunction justAvailable(cwd: string): Promise<boolean> {\n return new Promise((resolve) => {\n const child = execFile('just', ['--list', '--unsorted'], { cwd, timeout: 5000 }, (err) => {\n resolve(!err);\n });\n if (child.killed) resolve(false);\n });\n}\n\nexport async function detect(root: string): Promise<DetectResult> {\n const hasOpenspec = fs.existsSync(path.join(root, 'openspec'));\n const hasDocs = fs.existsSync(path.join(root, 'docs'));\n const hasJust = await justAvailable(root);\n const hasBugs = fs.existsSync(path.join(root, '.zgoal', 'config.yaml'));\n return { hasOpenspec, hasDocs, hasJust, hasBugs };\n}\n","import { createServer } from './server/index.js';\nimport { detect } from './server/detect.js';\n\nfunction parseArgs(a: string[]): Record<string, string | true> {\n const o: Record<string, string | true> = {};\n for (let i = 0; i < a.length; i++) {\n if (a[i].indexOf('--') === 0) {\n const n = a[i + 1];\n o[a[i].slice(2)] = n && n.indexOf('--') !== 0 ? a[++i] : true;\n }\n }\n return o;\n}\n\nconst args = parseArgs(process.argv.slice(2));\nconst root = (args.dir as string) ?? '.';\n\nconst det = await detect(root);\ncreateServer({\n root,\n port: args.port ? parseInt(args.port as string, 10) : undefined,\n open: !!args.open,\n detect: det,\n mode: args.mode as string | undefined,\n});\n"],"mappings":";;;AAAA,OAAO,UAAU;AACjB,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,OAAO,YAAY;AACnB,SAAS,YAAY;AACrB,SAAS,iBAAAC,sBAAqB;;;ACL9B,OAAO,QAAQ;AACf,OAAO,UAAU;AAWjB,SAAS,UAAU,QAAgB,QAAgB,QAAQ,GAAe;AACxE,MAAI,QAAQ,EAAG,QAAO,CAAC;AACvB,MAAI;AACJ,MAAI;AAAE,WAAO,GAAG,YAAY,QAAQ,EAAE,eAA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AM,OAAO,IAAI;AAC7B,aAAa;AAAA,EACX;AAAA,EACA,MAAM,KAAK,OAAO,SAAS,KAAK,MAAgB,EAAE,IAAI;AAAA,EACtD,MAAM,CAAC,CAAC,KAAK;AAAA,EACb,QAAQ;AAAA,EACR,MAAM,KAAK;AACb,CAAC;","names":["fs","path","fileURLToPath","root","fs","path","root","fs","path","__dirname","path","fileURLToPath","fs","det","handler","fp","fs","path","execFile","root"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zdashboard",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "ZCode skill dashboard platform — pluggable viewers for zdesign/zview/zreview/zgoal",
5
5
  "type": "module",
6
6
  "bin": { "zdashboard": "./dist/cli.js" },