diff --git a/.changeset/mcp-api-optimizations.md b/.changeset/mcp-api-optimizations.md deleted file mode 100644 index c35284d..0000000 --- a/.changeset/mcp-api-optimizations.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -"@contentrain/mcp": minor ---- - -Three additive GitHub-provider optimizations that cut API calls per write (no breaking changes) - -- **applyPlan blob inlining** — `applyPlanToGitHub` now inlines file content directly in the Git tree entries instead of POSTing a blob per file. A write drops from `N+3` GitHub mutations to a fixed `3` (tree + commit + ref) regardless of file count, easing the mutation-rate secondary limit. This brings the GitHub provider to parity with the GitLab provider, which already inlines content in its commit actions. Deletions are unchanged (null-sha entries); content is passed through byte-for-byte. -- **GitHubReader opt-in read memoization** — `new GitHubReader(client, repo, { memoize: true })` deduplicates repeated `(path, ref)` reads within one operation across `readFile` / `listDirectory` / `fileExists`. Opt-in and off by default; failed reads are evicted so transient errors are retried, not cached. The provider's own long-lived reader does not enable it (a reader that outlives a write must not serve stale results). -- **buildContextChange stats injection** — `buildContextChange(reader, operation, source, { stats })` lets a caller that already knows the model/entry counts skip the O(models·locales) reader walk; only `readConfig` remains. The emitted context.json is byte-identical to the scanned variant. Parameterless callers are unaffected. diff --git a/.changeset/transaction-batch-spawns.md b/.changeset/transaction-batch-spawns.md deleted file mode 100644 index c145289..0000000 --- a/.changeset/transaction-batch-spawns.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -"@contentrain/mcp": patch ---- - -Speed up local writes by batching git subprocess spawns in the worktree transaction - -Every local write (`content_save`, `model_save`, `bulk`, normalize apply, …) runs through `createTransaction`, which spawned ~40 `git` processes for a single content save. Two behavior-preserving batches cut that: - -- **Commit identity via environment** — the worktree git instance now carries `GIT_AUTHOR_*` / `GIT_COMMITTER_*` in its env instead of running two `git config user.*` spawns per transaction (and per `contentrain_merge`). Git honors these for both the sync merges and the feature-branch commit. -- **Batched selective sync** — `selectiveSync` replaced its per-file `git cat-file -e` existence loop with a single `git ls-tree` over the changed paths, and its per-file `git checkout HEAD -- ` loop with a single batched checkout (per-file fallback on error preserves precise skip accounting). Working-tree deletions are parallel fs removals. - -Measured: a 2-locale `content_save` drops from ~40 git spawns to ~30 (config 2→0, cat-file 5→0, checkout 7→3), roughly halving the operation's wall-clock. The selective-sync win scales with file count, so bulk writes benefit the most. No behavior change — the full worktree-transaction test suite passes unchanged. diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 3ee0316..8347489 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,15 @@ # contentrain +## 0.7.1 + +### Patch Changes + +- Updated dependencies [f1a2dce] +- Updated dependencies [cfface5] + - @contentrain/mcp@1.8.0 + - @contentrain/rules@0.5.3 + - @contentrain/skills@0.5.3 + ## 0.7.0 ### Minor Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index f166d3e..3421fe6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "contentrain", - "version": "0.7.0", + "version": "0.7.1", "license": "MIT", "description": "CLI for Contentrain — AI content governance infrastructure", "type": "module", diff --git a/packages/mcp/CHANGELOG.md b/packages/mcp/CHANGELOG.md index ccd73fd..c51d8f6 100644 --- a/packages/mcp/CHANGELOG.md +++ b/packages/mcp/CHANGELOG.md @@ -1,5 +1,26 @@ # @contentrain/mcp +## 1.8.0 + +### Minor Changes + +- f1a2dce: Three additive GitHub-provider optimizations that cut API calls per write (no breaking changes) + + - **applyPlan blob inlining** — `applyPlanToGitHub` now inlines file content directly in the Git tree entries instead of POSTing a blob per file. A write drops from `N+3` GitHub mutations to a fixed `3` (tree + commit + ref) regardless of file count, easing the mutation-rate secondary limit. This brings the GitHub provider to parity with the GitLab provider, which already inlines content in its commit actions. Deletions are unchanged (null-sha entries); content is passed through byte-for-byte. + - **GitHubReader opt-in read memoization** — `new GitHubReader(client, repo, { memoize: true })` deduplicates repeated `(path, ref)` reads within one operation across `readFile` / `listDirectory` / `fileExists`. Opt-in and off by default; failed reads are evicted so transient errors are retried, not cached. The provider's own long-lived reader does not enable it (a reader that outlives a write must not serve stale results). + - **buildContextChange stats injection** — `buildContextChange(reader, operation, source, { stats })` lets a caller that already knows the model/entry counts skip the O(models·locales) reader walk; only `readConfig` remains. The emitted context.json is byte-identical to the scanned variant. Parameterless callers are unaffected. + +### Patch Changes + +- cfface5: Speed up local writes by batching git subprocess spawns in the worktree transaction + + Every local write (`content_save`, `model_save`, `bulk`, normalize apply, …) runs through `createTransaction`, which spawned ~40 `git` processes for a single content save. Two behavior-preserving batches cut that: + + - **Commit identity via environment** — the worktree git instance now carries `GIT_AUTHOR_*` / `GIT_COMMITTER_*` in its env instead of running two `git config user.*` spawns per transaction (and per `contentrain_merge`). Git honors these for both the sync merges and the feature-branch commit. + - **Batched selective sync** — `selectiveSync` replaced its per-file `git cat-file -e` existence loop with a single `git ls-tree` over the changed paths, and its per-file `git checkout HEAD -- ` loop with a single batched checkout (per-file fallback on error preserves precise skip accounting). Working-tree deletions are parallel fs removals. + + Measured: a 2-locale `content_save` drops from ~40 git spawns to ~30 (config 2→0, cat-file 5→0, checkout 7→3), roughly halving the operation's wall-clock. The selective-sync win scales with file count, so bulk writes benefit the most. No behavior change — the full worktree-transaction test suite passes unchanged. + ## 1.7.0 ### Minor Changes diff --git a/packages/mcp/package.json b/packages/mcp/package.json index a167c8e..bc55263 100644 --- a/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -1,6 +1,6 @@ { "name": "@contentrain/mcp", - "version": "1.7.0", + "version": "1.8.0", "mcpName": "io.github.Contentrain/contentrain", "license": "MIT", "description": "Local-first MCP server for AI-generated content governance — 17 deterministic tools, stdio + HTTP transports, Local / GitHub / GitLab providers",