- beautifului.dev 组件直连:Sidebar Nav、Tool Chips、Approval Card(抽屉化)、Streaming/Thinking、Code Block、Selection Actions、Prompt Bar、Search
22 lines
865 B
JavaScript
22 lines
865 B
JavaScript
// 验证 pi SDK 对空目录(无会话的工作区)的行为:
|
|
// node scripts/repro-empty-workspace.mjs "C:\path\to\empty\dir"
|
|
import { SessionManager, getAgentDir } from '@earendil-works/pi-coding-agent'
|
|
import { mkdirSync, mkdtempSync } from 'node:fs'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
|
|
const target = process.argv[2] ?? mkdtempSync(join(tmpdir(), 'ws-empty-'))
|
|
mkdirSync(target, { recursive: true })
|
|
console.log('target cwd:', target)
|
|
|
|
try {
|
|
const sm = SessionManager.continueRecent(target)
|
|
console.log('continueRecent OK, sessionFile:', sm.sessionFile ?? '(none)')
|
|
const list = await SessionManager.list(target)
|
|
console.log('list count:', list.length)
|
|
} catch (err) {
|
|
console.error('continueRecent FAILED:', err instanceof Error ? err.message : err)
|
|
process.exit(1)
|
|
}
|
|
console.log('agentDir:', getAgentDir())
|