Skip to content

release: sync develop -> main (core 1.7.0 — manifest version injection)#110

Merged
samuelds merged 8 commits into
mainfrom
release/sync-inject-version
May 24, 2026
Merged

release: sync develop -> main (core 1.7.0 — manifest version injection)#110
samuelds merged 8 commits into
mainfrom
release/sync-inject-version

Conversation

@samuelds
Copy link
Copy Markdown
Contributor

Summary

Sync `develop` → `main` to publish `@focus-mcp/core@1.7.0` (and `@focus-mcp/sdk@1.7.0`, `@focus-mcp/validator@1.7.0` linked).

Bundles the fix from #109: `BrickSource.readPackageVersion?()` optional hook + `injectVersion()` in `loadBricks()`. Pair with `@focus-mcp/cli@2.4.1` (already published) which implements the hook on `FilesystemBrickSource`.

Effect after publish

End-to-end resolution of the INVALID_VERSION error that affected every `focus add ` call:

  1. CLI's `FilesystemBrickSource.readPackageVersion()` reads `@focus-mcp/brick-/package.json` → returns the version
  2. core's `loadBricks()` calls the hook, injects the result into the raw disk + module manifests if they lack a `version` field
  3. `parseManifest()` no longer throws INVALID_VERSION
  4. The returned `brick.manifest.version` carries the resolved value for consumers

Bumps

Package Old New
`@focus-mcp/core` 1.6.0 1.7.0 (minor — adds optional interface field)
`@focus-mcp/sdk` 1.6.0 1.7.0 (linked)
`@focus-mcp/validator` x.y.z bumped (linked)

Post-merge

`stable-publish` workflow publishes the three packages to npm via Trusted Publishers OIDC.

🤖 Generated with Claude Code

claude and others added 6 commits May 9, 2026 11:39
…09-post-core-1.6.0

chore: back-merge main into develop (post core 1.6.0)
…BrickSource hook

Published @focus-mcp/brick-* packages don't carry a `version` field in
`mcp-brick.json` — the version lives in their `package.json`. So every
brick load via the CLI was throwing INVALID_VERSION at parseManifest().

This commit:

- Adds an optional `readPackageVersion(name): Promise<string|undefined>`
  to the `BrickSource` interface. Backwards-compatible — sources that
  don't implement it behave exactly as before.
- In `loadBricks()`, calls the hook (when available) and injects the
  returned value into both the raw disk manifest and the raw module-
  exported manifest before they reach `parseManifest()`.
- Adds `injectVersion()` helper: non-mutating, preserves existing
  `version` values, passes non-object raws through untouched.
- 4 new unit tests cover: injection on missing version, preservation of
  existing version, INVALID_VERSION when hook is absent, INVALID_VERSION
  when hook returns undefined. 387/387 pass.

Pair with @focus-mcp/cli@2.4.1 which implements the hook on
FilesystemBrickSource.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… hook + test assertions

Addresses copilot[bot] review on PR #109 (4 findings):

1. Bug: injectVersion() ran for validation but the brick pushed into
   result.bricks was the original (no-version) one — consumers reading
   `brick.manifest.version` would still see undefined. Now we push the
   brick with the parsed (version-injected) manifest.
2. Bug: readPackageVersion() was called unconditionally and any throw
   propagated as a load failure — even when the manifest already had a
   valid version. Now wrapped in try/catch: on throw, pkgVersion falls
   back to undefined and the manifest's own version (if any) is used.
3. Test gap: the existing "injects version" test didn't assert that the
   version reached the returned brick. Added the missing assertion.
4. Test comment: the "does not override" test had a comment referring
   to version '9.9.9' that didn't match the actual values. Fixed.

Plus a new test for the hook-throws-but-manifest-has-version case
(scenario #2 above). 388/388 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat(loader): inject package.json version into manifest via optional BrickSource hook
Copilot AI review requested due to automatic review settings May 24, 2026 20:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Syncs developmain for the @focus-mcp/* 1.7.0 release train, including the core loader enhancement that injects a brick version from package.json (via an optional BrickSource hook) to prevent INVALID_VERSION failures when mcp-brick.json omits version.

Changes:

  • Bump versions for @focus-mcp/core (1.7.0), @focus-mcp/sdk (1.7.0), and @focus-mcp/validator (1.0.10) and update changelogs.
  • Add optional BrickSource.readPackageVersion() and inject its result into source/module manifests before validation.
  • Add unit tests covering version injection and fallback behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core/src/loader/brick-loader.ts Adds optional version hook and injects resolved version into manifests during loadBricks().
packages/core/src/loader/brick-loader.test.ts Adds tests for version injection, non-override behavior, and fallback failure cases.
packages/core/package.json Bumps @focus-mcp/core to 1.7.0.
packages/core/CHANGELOG.md Documents the 1.7.0 loader change.
packages/sdk/package.json Bumps @focus-mcp/sdk to 1.7.0.
packages/sdk/CHANGELOG.md Notes dependency update for 1.7.0.
packages/validator/package.json Bumps @focus-mcp/validator to 1.0.10.
packages/validator/CHANGELOG.md Notes dependency update for 1.0.10.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/loader/brick-loader.ts Outdated
samuelds and others added 2 commits May 24, 2026 22:27
…otype methods

Addresses copilot[bot] review on PR #110: `{ ...brick, manifest: moduleManifest }`
produces a plain object that loses prototype-defined methods. A brick may
legitimately be a class instance with `start()`/`stop()` on its prototype —
spreading would silently break them.

Switch to in-place mutation of `brick.manifest`. The `Brick` interface
declares it `readonly` but at the JS runtime level we can update the
reference; this preserves the prototype and any non-enumerable members.

Plus a new test that exercises a class-instance brick and asserts both
the injected version AND prototype preservation. 389/389 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@samuelds samuelds merged commit 4106875 into main May 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants