release: sync develop -> main (core 1.7.0 — manifest version injection)#110
Merged
Conversation
…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
There was a problem hiding this comment.
Pull request overview
Syncs develop → main 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.
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Bumps
Post-merge
`stable-publish` workflow publishes the three packages to npm via Trusted Publishers OIDC.
🤖 Generated with Claude Code