82 Commits

Author SHA1 Message Date
xiaoju 01cf04fb3a docs: rewrite changelogs — per-package scope, add dates, fix 0.4.1 entry
CI / check (pull_request) Successful in 2m52s
2026-06-07 15:34:13 +00:00
xiaoju 4659258693 fix: gc must traverse oneOf and preserve template content
CI / check (pull_request) Successful in 3m46s
collectRefs silently skipped oneOf even though it is in the meta-schema's
allowed keys. uwf step nodes use the standard JSON-Schema idiom
oneOf: [{type:"null"}, {type:"string", format:"ocas_ref"}] for nullable
prev/detail/start refs, so walk() never reached the chain and gc swept
the intermediate steps as false orphans. Mirror the anyOf branch in
collectRefs so every oneOf variant contributes refs.

Also align gc with closure.ts Phase 3: walk @ocas/template/text/<schema>
content for every reachable schema so rendered template nodes survive
when their schema is reachable, and are still collected when the schema
itself is unreachable.

Fixes #93
2026-06-07 13:06:59 +00:00
xiaoju 741fea9e51 release: v0.4.0
CI / check (pull_request) Successful in 2m20s
2026-06-07 13:25:45 +08:00
xingyue 522b782571 chore: release @ocas/core@0.4.0, @ocas/fs@0.4.0, @ocas/cli@0.4.0 2026-06-07 13:25:10 +08:00
xiaoju dbfaf01031 docs: add export/import to README/cards; tidy bundle.ts imports
CI / check (pull_request) Successful in 2m35s
Address reviewer feedback on #83:

- Replace dynamic `await import("./bootstrap-capable.js")` in
  bundle.ts with a static top-of-file import (no real cycle exists,
  bootstrap.ts is already statically imported).
- Remove unused `bootstrapSym` Symbol.for() / `void bootstrapSym`
  dead code in importBundle.
- Move the misplaced `import { decode } from "cborg"` to the top of
  bundle.ts with the other imports.
- Document the new `export` / `import` commands and `--store`,
  `--scope`, `-o` flags in:
  - root README.md (commands + global flags)
  - packages/cli/README.md (command table + bundles section + global flags)
  - packages/cli/prompts/usage.md (`ocas prompt usage` output)
  - packages/core/README.md (Closure & Bundles API surface)
  - .cards/cli.md (bundle commands + --store architecture note)
2026-06-07 03:19:59 +00:00
xiaoju 4ba3a00de9 feat: add CAS closure export/import bundles
Implements `ocas export` / `ocas import` for shipping a self-contained
closure of CAS nodes, variables and tags between stores, plus a
read-only `--store <bundle.tar>` flag for inspecting bundles without
extracting them.

- core: computeClosure walks refs + schema chains and gathers vars/tags
- core: exportBundle / importBundle / loadBundleStore use a custom
  POSIX/ustar tar (no external deps); content-addressed dedup on import,
  optional --scope remap of non-@ocas variable names
- core: new @ocas/output/export and @ocas/output/import builtin schemas
- cli: new export and import commands, --store read-only mode, write
  commands rejected with a clear error when --store is set

Closes #83
2026-06-07 01:13:36 +00:00
xiaoju 7871db748f feat: add 'ocas prompt list' subcommand
CI / check (pull_request) Successful in 4m55s
Implements the missing 'list' case referenced in bootstrap output.

小橘 🍊
2026-06-06 14:29:22 +00:00
xiaoju e3c84c5794 chore: rename prompt setup→bootstrap, programmatic generation, bun→pnpm cleanup
CI / check (pull_request) Successful in 2m59s
Part 1: Rename 'ocas prompt setup' → 'ocas prompt bootstrap' in CLI
Part 2: Replace static setup.md with cmdPromptBootstrap() function
  - CLI_VERSION injected dynamically (same pattern as uwf)
  - Covers fresh install + upgrade scenarios
  - Includes preflight checks, skill install, e2e verification
Part 3: Clean up bun references in workflow YAML files
  - .workflows/retrospect-workflow.yaml: bun→pnpm
  - .workflows/solve-issue.yaml: bun→pnpm
  - .workflows/e2e-check.yaml: archived to legacy-packages/

Fixes #80
小橘 🍊
2026-06-06 14:03:24 +00:00
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