Commit Graph

74 Commits

Author SHA1 Message Date
tuanzi e4e4ce0f73 fix: suppress SQLite ExperimentalWarning in edge-cases and schema-validation tests
The local runCli helpers in edge-cases.test.ts (Phase 3/4/7) and raw
execFileSync calls in schema-validation.test.ts (tests 2.1, 2.3) were
missing NODE_NO_WARNINGS=1, causing ExperimentalWarning to leak into
stderr snapshots. Added env override to match what helpers.runCli
already does.
2026-06-04 00:36:38 +00:00
tuanzi 13b12ef50c fix: resolve prompt files from package root instead of dist
prompts/*.md files are not copied to dist/ during tsc build,
causing `ocas prompt setup/usage` to fail with ENOENT.

- Change join(__dirname, "prompts") → join(__dirname, "..", "prompts")
- Add prompts/ to package.json "files" for npm publishing
- Update snapshots (Node.js SQLite ExperimentalWarning + version string)
2026-06-04 00:11:28 +00:00
xiaomo a9d43abf28 release: @ocas/cli@0.3.1 2026-06-04 00:01:29 +00:00
xiaomo 6f054f6447 fix(cli): update prompts — bun→pnpm, remove stale --var-db flag 2026-06-03 23:49:11 +00:00
xiaomo 5e9b266ebd docs: add pkg descriptions/keywords/engines, fix core README
Fixes #70, #71, #72, #73
2026-06-03 23:23:48 +00:00
xiaomo c4d9205eb2 docs: update all documentation for node:sqlite, pnpm, proman workflow
- README: bun → pnpm, update API examples, add Node >=22.5.0 requirement
- CLAUDE.md: replace 3-phase release process with proman bump/publish
- Package READMEs: fix package names, update storage/API descriptions
- Cards: update store.md (sqlite), cli.md (db filename, remove --var-db)
- docs/sync-readme.md: update to proman workflow
2026-06-03 23:21:30 +00:00
xiaomo 7e9bd26fec fix: suppress ExperimentalWarning in tests via NODE_NO_WARNINGS env
- Use NODE_NO_WARNINGS=1 in execFileSync env instead of --no-warnings flag
- Remove overly broad process.removeAllListeners('warning') from CLI entry
- Add engines field requiring Node >=22.5.0 (node:sqlite availability)
- Update proman to 0.4.2
2026-06-03 23:02:43 +00:00
xiaomo 3168bf55c3 chore: add changeset for node:sqlite migration 2026-06-03 22:30:15 +00:00
xiaomo 00a536631a refactor: migrate from better-sqlite3 to node:sqlite
- Replace better-sqlite3 with built-in node:sqlite (DatabaseSync)
- Add transaction() helper for manual BEGIN/COMMIT/ROLLBACK
- Suppress ExperimentalWarning in CLI tests with --no-warnings
- Remove better-sqlite3 from dependencies and onlyBuiltDependencies
- No more native addon compilation issues across Node versions
2026-06-03 22:11:44 +00:00
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
2026-06-03 11:16:16 +00:00
xiaoju f286df91f0 chore: restore workspace:* 2026-06-03 09:43:57 +00:00
xiaoju 5c0670e69b release: prepare v0.2.1 2026-06-03 09:40:07 +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 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 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
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 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 12b61b4625 fix: set correct version in fs/cli package.json (was workspace:*) 2026-06-02 14:40:41 +00:00
xiaoju 4d6d090bb9 chore: restore workspace:* on main 2026-06-02 12:53:58 +00:00
xiaoju 185c4c779b chore: release 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 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 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 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 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 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 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 0f10580937 test: update snapshots for Phase 2 changes 2026-06-02 06:54:09 +00:00
xiaoju c83e98cd7e docs: use @ocas/ prefix consistently in test names, comments, and error messages 2026-06-02 04:40:06 +00:00
xiaoju db5272a64a docs(cli): fix README — use @ocas/schema instead of @schema shorthand 2026-06-02 04:29:01 +00:00
xiaoju e1c4fb86bc chore: restore workspace:* deps on main 2026-06-02 04:27:01 +00:00
xiaoju 3d19707e7b chore: release v0.1.2 2026-06-02 04:26:49 +00:00
xiaoju 20922d92c2 chore: publish 0.1.2-rc.2 2026-06-02 04:19:23 +00:00
xiaoju 45f0d83af3 fix(cli): replace postinstall with help hint, update setup to guide old skill cleanup
- Remove postinstall script (blocked by bun security policy)
- Add agent skill hint with version to help output
- Update setup.md to guide cleanup of old skill versions
2026-06-02 04:06:43 +00:00
xiaoju 56f003077a chore: publish 0.1.2-rc.1 2026-06-02 03:37:43 +00:00
xiaoju 52ebd9ed8e chore: prepare release/0.1.2 — fix workspace deps to 0.1.1 2026-06-02 03:32:49 +00:00
xiaoju ec6db5f494 fix(cli): use bun for postinstall (consistent with cli runtime) 2026-06-02 03:24:19 +00:00
xiaoju 5d54c0988c fix(cli): use node instead of sh for postinstall (Windows compat) 2026-06-02 03:22:20 +00:00
xiaoju 191926428a feat(cli): add postinstall message guiding agents to run ocas prompt setup 2026-06-02 03:18:38 +00:00
xiaoju 84386f8a63 docs: add 0.1.0 initial release entries to CHANGELOGs 2026-06-02 03:10:43 +00:00
xiaoju eebdeb23da chore: clean up CHANGELOGs — remove pre-OCAS history
Drop all entries from the uncaged/json-cas era (≤0.6.0). OCAS starts
at 0.1.0; only 0.1.1+ entries are relevant.
2026-06-02 03:09:15 +00:00
xiaoju 350ee3d7b5 style: fix all biome warnings and infos
- Use template literals instead of string concatenation
- Remove unused imports and variables
- Use export type for type-only exports
- Use literal keys instead of computed string keys
2026-06-02 03:07:34 +00:00
xiaoju 8176a228b2 fix: resolve all TypeScript LSP errors in CLI package
1. CLI tsconfig: disable composite/declaration/declarationMap, enable
   noEmit — CLI runs via bun, never compiled by tsc. Eliminates all
   TS6059/TS6307 rootDir errors.

2. Use conditional spread to filter undefined values before passing to
   renderAsync/renderDirect/tag — satisfies exactOptionalPropertyTypes.

3. Fix TS2304: schemaHash not in scope in template delete catch block,
   use schemaInput instead.

Fixes #36
2026-06-02 02:58:47 +00:00
xiaoju 1554fbc719 fix: render trailing newline and pipe mode template rendering
- Add trailing newline to all render output (#33)
- Fix render -p pipe mode to resolve hash values through renderAsync
  with template support instead of renderDirect (#34)
- Always open varStore in render command (needed for pipe+hash path)
- Update test expectations for trailing newline

Fixes #33
Fixes #34
2026-06-02 02:34:36 +00:00
xiaoju 3d903eaff8 chore: restore workspace:* deps on main 2026-06-02 02:08:29 +00:00
xiaoju 0919f71f7e chore(release): v0.1.1
- ocas prompt usage/setup commands
- --version flag
- CHANGELOG cleanup: fix package names @uncaged/* → @ocas/*
2026-06-02 02:07:48 +00:00
xiaoju 944f6c3254 chore: bump version to 0.1.1-rc.2 2026-06-02 02:00:58 +00:00
xiaoju ab1e6df774 feat: add --version flag to CLI
Reads version from package.json and prints to stdout.

Fixes #32
2026-06-02 00:39:16 +00:00
xiaoju 04433e81ab chore: set version 0.1.1-rc.1 for prerelease 2026-06-02 00:01:57 +00:00