sillyspec 3.32.7 → 3.32.9

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.
@@ -0,0 +1,21 @@
1
+ // flow-state.yaml 单一源读取(2026-10-13-thin-sync-stage:自 flow.js 上移的叶子模块)。
2
+ // 依赖仅 node:fs / node:path / js-yaml——供 progress.js(同步投影)与 flow.js(协议主
3
+ // 实现,re-export 保持 `import('../flow.js')` 既有引用面)共享;叶子化让 progress.js
4
+ // 不必为读一个状态文件拉入 flow 协议整条依赖链(评审 P3:非循环依赖问题,flow.js 静态
5
+ // import 闭包实测不达 progress.js)。
6
+ import { readFileSync } from 'node:fs'
7
+ import { join } from 'node:path'
8
+ import yaml from 'js-yaml'
9
+
10
+ export const FLOW_STATE_FILE = 'flow-state.yaml'
11
+
12
+ /** 读 flow-state(缺文件/损坏 → null = 未参与 thin)。 */
13
+ export function readFlowState(changeDir) {
14
+ try {
15
+ const raw = readFileSync(join(changeDir, FLOW_STATE_FILE), 'utf8')
16
+ const obj = yaml.load(raw)
17
+ return obj && typeof obj === 'object' ? obj : null
18
+ } catch {
19
+ return null
20
+ }
21
+ }