#69 Phase 1a: 自动 bootstrap — openStore() 每次自动 mkdir + bootstrap #73

Closed
opened 2026-05-31 12:46:01 +00:00 by xiaoju · 0 comments
Owner

Parent: #69 (Phase 1 of #67)

Scope(仅此一件事)

openStore() 改为每次调用自动 mkdirSync(storePath, { recursive: true }) + await bootstrap(store)

具体改动

  1. openStore() 改为 async,内部调用 bootstrap()
  2. 删除 shouldCreate 参数 — 不再区分读写,统一行为
  3. 删除 validateStoreExists() — bootstrap 会自动创建目录
  4. 所有调用 openStore() 的地方加 await
  5. 删除 initbootstrap 命令(它们的功能被 openStore 吸收了)
  6. 更新 help 文本 — 移除 init/bootstrap 的条目

不做的事

  • 不注册 @output/* schema(Phase 1c)
  • 不删除 schema/cat 子命令(Phase 1b)
  • 不改任何命令的输出格式

关键约束

  • bootstrap() 是幂等的,重复调用无副作用
  • 现有测试中有些直接调 createMemoryStore() 不经过 openStore(),这些不受影响
  • CLI 测试中用 --store /tmp/xxx 的,现在会自动初始化,不再需要先 init

Verification

  • bun test 全部通过(测试数量不变或仅删减 init/bootstrap 相关的)
  • bun run build 通过
  • bun run check 通过
  • ucas initucas bootstrap 报 unknown command
  • 任意命令在空 store 目录自动初始化
## Parent: #69 (Phase 1 of #67) ## Scope(仅此一件事) 将 `openStore()` 改为每次调用自动 `mkdirSync(storePath, { recursive: true })` + `await bootstrap(store)`。 ### 具体改动 1. **`openStore()` 改为 async**,内部调用 `bootstrap()` 2. **删除 `shouldCreate` 参数** — 不再区分读写,统一行为 3. **删除 `validateStoreExists()`** — bootstrap 会自动创建目录 4. **所有调用 `openStore()` 的地方加 `await`** 5. **删除 `init` 和 `bootstrap` 命令**(它们的功能被 openStore 吸收了) 6. **更新 help 文本** — 移除 init/bootstrap 的条目 ### 不做的事 - ❌ 不注册 @output/* schema(Phase 1c) - ❌ 不删除 schema/cat 子命令(Phase 1b) - ❌ 不改任何命令的输出格式 ### 关键约束 - `bootstrap()` 是幂等的,重复调用无副作用 - 现有测试中有些直接调 `createMemoryStore()` 不经过 `openStore()`,这些不受影响 - CLI 测试中用 `--store /tmp/xxx` 的,现在会自动初始化,不再需要先 init ### Verification - `bun test` 全部通过(测试数量不变或仅删减 init/bootstrap 相关的) - `bun run build` 通过 - `bun run check` 通过 - `ucas init` 和 `ucas bootstrap` 报 unknown command - 任意命令在空 store 目录自动初始化
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/json-cas#73