269 Commits

Author SHA1 Message Date
xiaoju 36ebf42f2f chore: bump 0.2.2, fix lint, biome format
- Bump all packages to 0.2.2
- Fix noNonNullAssertion in cli/index.ts
- Fix unused imports in fs/sqlite-store.ts
- Biome 2.4.16 migration + format all files
- Update snapshots for version change
v0.2.2
2026-06-03 11:16:16 +00:00
xiaoju f286df91f0 chore: restore workspace:* 2026-06-03 09:43:57 +00:00
xiaoju 8971206a3e Merge release/0.2.1 into main 2026-06-03 09:43:37 +00:00
xiaoju 807c0942e8 release: v0.2.1
- Clean dist: no stale variable-store.js (bun:sqlite reference removed)
- Fix vitest rejects pattern in liquid-render tests
- proman.yaml runtime: bun → node
- Upgrade @shazhou/proman to 0.2.2
v0.2.1
2026-06-03 09:43:27 +00:00
xiaoju 5c0670e69b release: prepare v0.2.1 2026-06-03 09:40:07 +00:00
xiaoju c90efda4dd chore: upgrade @shazhou/proman to 0.2.2 2026-06-03 09:39:59 +00:00
xiaoju 2d4f76330c fix: vitest rejects pattern + runtime config
- Fix 4 liquid-render tests: expect(async()=>{}).rejects → expect(promise).rejects
- proman.yaml: runtime bun → node (matches actual stack)
- package.json: test script uses vitest directly (avoid proman recursion)
- Add changeset for 0.2.1 patch (clean dist)
2026-06-03 09:30:23 +00:00
xiaomo 768ae20a24 Merge pull request 'feat: migrate var/tag store from JSONL to better-sqlite3' (#68) from feat/60-sqlite-var-tag into main
feat: migrate var/tag store from JSONL to better-sqlite3 (#68)
2026-06-03 08:40:45 +00:00
xiaoju 72ba313d12 fix: address review — transactions, LIKE escape, post-filter pagination
Critical fixes:
1. LIKE ESCAPE '\' clause added for namePrefix queries
2. list() limit/offset now applied AFTER tag/label post-filter
3. tag()/untag() wrapped in db.transaction()

Warning fixes:
4. set()/update() wrapped in db.transaction() (txnSetVar)
5. listByTag sort/limit/offset pushed to SQL
6. close() idempotent (double-close guard)
7. JSONL → SQLite migration on first open (vars + tags)
8. History truncation simplified (NOT IN subquery)
9. Removed unnecessary pre-fetch in upsert (ON CONFLICT handles it)

Nits:
10. Database.Database type instead of InstanceType
11. row.name instead of row["name"]
12. DESC index on var_history position
13. key+value composite index on tags
2026-06-03 08:38:44 +00:00
xiaoju 1fe6035be5 feat: migrate var/tag store from JSONL to better-sqlite3
- New sqlite-store.ts: VarStore + TagStore backed by SQLite (WAL mode)
- Tables: vars (composite PK name+schema), var_history (with MAX_HISTORY truncation), tags (composite PK target+key)
- Indexed queries for name, created, updated, tag key
- Tags/labels stored as JSON columns with post-filter
- Removed var-store.ts (JSONL append-log implementation)
- Updated tests: JSONL assertions → SQLite db file checks

Closes #60
2026-06-03 08:29:22 +00:00
xiaoju e3f7ec1a11 Merge pull request 'chore: 去掉 Bun,切换到 pnpm + 纯 Node runtime' (#67) from chore/66-remove-bun into main 2026-06-03 07:55:03 +00:00
xiaoju 9ac08e5893 chore: 去掉 Bun,切换到 pnpm + 纯 Node runtime
- bun.lock → pnpm-lock.yaml + pnpm-workspace.yaml
- 删除 sqlite-adapter.ts(Bun/Node 双 runtime 兼容层,未被使用)
- package.json 删除 workspaces 字段,加 pnpm.onlyBuiltDependencies
- 加 vite 8 显式依赖(vitest 4.x peer dep)
- CLAUDE.md 全面更新:Runtime/Commands/Release 流程
- .gitignore 加 bun.lock

36/36 files pass, 617/617 tests pass

Fixes #66
2026-06-03 07:43:09 +00:00
xiaoju fe56634160 fix: clean build 兼容性修复
- 根 package.json 加 @types/node(clean install 后 tsc 需要)
- CLI tests entrypoint 从 src/index.ts 改为 dist/index.js
- 局部 runCli 支持 rest 和 array 两种调用模式(rawArgs.flat())
- 所有剩余 tsx 引用改为 node

36/36 files pass, 617/617 tests pass

Fixes #64
2026-06-03 06:32:39 +00:00
xiaoju dd75c1f39d Merge pull request 'fix: 修复 vitest 迁移后测试失败' (#65) from fix/64-test-failures into main 2026-06-03 06:16:56 +00:00
xiaoju 32b520b2a4 fix: 修复 vitest 迁移后测试失败
- async 函数断言改用 await expect().rejects.toThrow()
- 所有局部 runCli 从 tsx 改为 node
- rest params (...args) 改为 array params (args)
- 更新 snapshots

36/36 files pass, 617/617 tests pass

Fixes #64
2026-06-03 06:16:33 +00:00
xiaoju 05f3246e5b Merge pull request 'chore: 测试框架从 bun:test 迁移到 vitest' (#63) from chore/62-vitest into main 2026-06-03 04:16:29 +00:00
xiaoju 736d7e7374 chore: 测试框架从 bun:test 迁移到 vitest
- 36 个 test 文件 bun:test → vitest
- Bun.spawn() → execFileSync('tsx', ...)
- Bun.file() → readFileSync
- import.meta.dir → import.meta.dirname (tests) / __dirname (CLI source)
- 删除 bun-types devDep
- 添加 vitest + tsx devDep
- CLI shebang bun → node
- 30/36 test files pass, 558/617 tests pass

Refs #62
2026-06-03 04:11:10 +00:00
xiaomo 3cfcf6db89 Merge pull request 'feat: cli 包完整 build 支持(tsc emit + Node 兼容)' (#61) from feat/58-cli-build into main 2026-06-03 03:28:31 +00:00
xiaoju 5f562cbc5a feat: cli 包完整 build 支持(tsc emit + Node 兼容)
- tsconfig: 启用 emit (rootDir/outDir/composite), 添加 project references
- shebang: bun → node
- bin: src/index.ts → dist/index.js
- import.meta.dir → import.meta.dirname (去掉 Bun 专有 API)
- prompts 目录移到包根, src/dist 路径统一
- 修复 exactOptionalPropertyTypes 类型错误

Fixes #58
2026-06-03 02:29:01 +00:00
xiaoju 234bd0d611 chore: remove legacy release scripts (replaced by proman)
小橘 🍊
2026-06-03 00:37:15 +00:00
xiaoju ff4c4f3eff chore: remove per-package scripts (test/prepublishOnly)
All dev commands handled by proman at root level.
workspace:* safety handled by proman release flow.

小橘 🍊
2026-06-03 00:36:04 +00:00
xiaoju 39e4e4faca chore: remove changeset deps, release now handled by proman
小橘 🍊
2026-06-03 00:25:04 +00:00
xiaoju 799ef0af92 chore: consolidate dev deps via @shazhou/proman
Remove direct biome and typescript devDependencies.
All dev commands (build/test/check/format) now go through proman.

小橘 🍊
2026-06-03 00:10:14 +00:00
xiaoju 845ecb635e chore: add per-package build scripts for proman compatibility
小橘 🍊
2026-06-02 16:30:27 +00:00
xiaoju aa0584dea7 chore: switch proman config from TS to YAML 2026-06-02 15:47:25 +00:00
xiaoju 12b61b4625 fix: set correct version in fs/cli package.json (was workspace:*) 2026-06-02 14:40:41 +00:00
xiaoju 22dec2ae7a chore: add proman.config.ts 2026-06-02 14:40:01 +00:00
xiaoju 4d6d090bb9 chore: restore workspace:* on main 2026-06-02 12:53:58 +00:00
xiaoju 6d89c60401 Merge release/0.2.0 into main 2026-06-02 12:53:48 +00:00
xiaoju 185c4c779b chore: release v0.2.0 v0.2.0 2026-06-02 12:53:38 +00:00
xiaoju b49da8ebbd chore: publish @ocas/*@0.2.0-rc.1 2026-06-02 12:19:29 +00:00
xiaoju 298a8ec626 chore: prepare release/0.2.0 — fix workspace:* to real versions 2026-06-02 11:50:47 +00:00
xiaoju 67620e0d57 docs: add changesets for #52/#53 and update card docs for tag commands 2026-06-02 11:45:37 +00:00
xiaoju fcb514ef50 Merge pull request 'feat: --tag filter for list / var list' (#57) from fix/54-list-tag-filter into main 2026-06-02 11:39:29 +00:00
xiaoju ca334692b7 feat: add --tag filter to ocas list and ocas var list
Multiple --tag flags AND together. Tag format: key:value for tags,
bare name for labels. Without --tag, existing behavior is preserved.

Fixes #54
2026-06-02 11:36:55 +00:00
xiaoju 54f225a514 Merge pull request 'feat: show tag info in get / var get output' (#56) from fix/53-tag-info-output into main 2026-06-02 11:26:51 +00:00
xiaoju 4ebae73257 feat: add tag info to ocas get and ocas var get output
When a CAS node has tags, ocas get includes them in the envelope's
value as a `tags` array. When a variable's value hash has tags,
ocas var get includes them as a `valueTags` array (separate from
the variable's own tags/labels). Untagged nodes/values produce
byte-identical output as before (no empty array serialized).

Schemas @ocas/output/get and @ocas/output/var-get extended to
accept the new optional fields.

Closes #53
2026-06-02 11:24:39 +00:00
xiaoju 78ab8538cd Merge pull request 'feat: top-level ocas tag/untag commands' (#55) from fix/52-tag-untag into main 2026-06-02 11:13:57 +00:00
xiaoju 561f2a33b7 feat: add top-level ocas tag/untag commands, remove var tag
Adds `ocas tag <target> <tag>...` and `ocas untag <target> <tag>...`
top-level CLI commands operating on store.tag.* (TagStore). Targets
may be hashes or @scope/name variables (resolved via resolveHash).

The redundant `ocas var tag` subcommand is removed; `var tag` now
falls through to "Unknown var subcommand: tag".

Registers `@ocas/output/tag` and `@ocas/output/untag` schemas and
templates in bootstrap; removes `@ocas/output/var-tag`.

Closes #52

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-02 11:11:29 +00:00
xiaoju 3fb179abde chore: add changeset for unified Store refactor (#38) 2026-06-02 10:28:52 +00:00
xiaoju f22eb5deab docs: update cards and CLAUDE.md for unified Store refactor 2026-06-02 10:23:49 +00:00
xiaoju 0735e7ca24 Merge pull request 'fix(core,fs): phase 3 cleanup — drop legacy Store, sync bootstrap, dedup VarStore' (#49) from fix/47-phase3-cleanup into main 2026-06-02 10:10:42 +00:00
xiaoju 0041fc4e23 fix(core,fs): phase 3 cleanup — drop legacy Store, sync bootstrap, dedup VarStore
- Remove legacy `Store` type with `Promise<Hash>` `put`; rename `OcasStore` → `Store`
  across @ocas/core, @ocas/fs, @ocas/cli (production + tests).
- Migrate `BootstrapCapableStore` to `CasStore`; `[BOOTSTRAP_STORE]` returns `Hash`
  synchronously.
- Make `bootstrap()` and `putSchema()` synchronous; remove `await` at all call sites.
- Extract pure VarStore helpers into `packages/core/src/var-store-helpers.ts`
  (`varKey`, `addNameIndex`, `removeNameIndex`, `extractSchema`, `checkTagLabelConflict`,
  `pushHistory`, `cloneVarRecord`, `VarRecord`); both `MemoryVarStore` (-74 lines) and
  `FsVarStore` (-63 lines) now delegate to them while keeping persistence separate.

Refs #47
2026-06-02 10:02:19 +00:00
xiaoju e398d090b0 Merge pull request 'fix(fs): add FsStore var/tag test coverage and share validateName' (#48) from fix/42-fsstore-implements-store into main 2026-06-02 09:35:08 +00:00
xiaoju 9965e75c22 feat(fs): add FsStore var/tag test coverage and share validateName
Phase 4 of unified Store refactor (#38):
- Add FsVarStore tests (12 cases) and FsTagStore tests (11 cases)
  covering CRUD, persistence-across-reopen, JSONL replay fidelity,
  ListOptions, and error paths.
- Extract validateName into packages/core/src/validation.ts; remove
  duplicated copies in core/src/store.ts and fs/src/var-store.ts.
- Fix FsTagStore.listByTag to honor ListOptions (limit/offset/desc)
  via applyListOptions, matching the in-memory implementation.
- Replace stale openStoreAndVarStore example in usage.md with
  openStore returning OcasStore; add grep-based regression test.
- Add OcasStore shape assertion in fs/src/store.test.ts.

Closes #42; partially addresses #47 (items 1, 3).
2026-06-02 09:27:44 +00:00
xiaoju 385815534f Merge pull request 'refactor(core): update all functions to accept OcasStore (single param)' (#46) from fix/41-ocas-store-single-param into main 2026-06-02 09:05:57 +00:00
xiaoju e53f473fc2 refactor(core): update all functions to accept OcasStore (single param)
- bootstrap(store) — uses store.cas + store.var
- gc(store) — uses store.cas + store.var
- render/renderAsync/renderDirect — uses store.cas + store.var for templates
- refs/walk/validate/getSchema/putSchema — uses store.cas
- wrapEnvelope — uses store.cas + store.var
- registerOutputTemplates — uses store.cas + store.var
- Remove VariableStore SQLite class from @ocas/core
- Zero bun:sqlite imports in core
- Update @ocas/fs and @ocas/cli to new signatures
- 560 tests pass

Fixes #41
2026-06-02 08:15:07 +00:00
xiaoju 8c075b3310 Merge pull request 'feat(core): MemoryStore returns OcasStore (cas + var + tag)' (#45) from fix/40-memorystore-ocas into main 2026-06-02 06:54:24 +00:00
xiaoju 0f10580937 test: update snapshots for Phase 2 changes 2026-06-02 06:54:09 +00:00
xiaoju 56e3253829 feat(core): MemoryStore returns OcasStore (cas + var + tag)
Rewrite createMemoryStore() to return an OcasStore with three sub-stores:
cas, var, tag. The cas sub-store keeps the existing Map-based logic, but
its put is now synchronous; the in-memory VarStore and TagStore are new
Map-based implementations of the types defined in #39.

The legacy Store.put signature is widened to Hash | Promise<Hash> so that
the new sync cas can still be passed to helpers (bootstrap, gc, render,
schema, …) that have not yet been migrated to the unified surface.

Tests in packages/core were mechanically updated from store.* to
store.cas.* and new test suites for VarStore (var-store.test.ts) and
TagStore (tag-store.test.ts) cover the spec from issue #40.

Closes #40

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-02 06:30:01 +00:00