Repository navigation
feat(cli): install shared-model dependencies from npm and Python packages in meta deps sync - #501
Merged
Merged
Conversation
A shared model can now travel inside a published package instead of only
over a folder path. A dependency declared as { "npm": "@acme/model",
"dir": "metaobjects" } or { "python": "acme_model", "dir": "metaobjects" }
is found where the consumer's package manager installed it: node_modules
up the tree from the directory holding .metaobjects/, or
importlib.util.find_spec in the project's interpreter ($METAOBJECTS_PYTHON,
then $VIRTUAL_ENV, then a .venv beside .metaobjects/, then python3). sync
snapshots and locks it exactly as a path dependency; check and verify
--deps resolve the same way. A package that is not installed, a missing
interpreter or a dir the package does not ship is ERR_DEPENDENCY_UNRESOLVED
naming the npm install / pip install fix, and sync warns when the installed
package's version differs from its manifest. The lock format is unchanged
and records no host path.
On the publisher side, sharedModelFile()'s default version also reads a
pyproject.toml [project] version. The feature doc gains the two-step
publish path for npm and Python packages and a private-registry recipe.
The dependency corpus gains npm and python snapshot-load cases (run by
TypeScript and Python) and a transport-cases.json arm (14 cases, Node
only) that lays packages out under a temp node_modules and import path.
…re Python versions
…not installed find_spec raises ModuleNotFoundError when a parent of a dotted name is missing. Treat that as not installed, with the pip install hint, and keep the import-error wording for a parent whose own import fails on some other module.
# Conflicts: # README.md # agent-context/skills/metaobjects-codegen/references/dependencies-and-shared-models.md # docs/CONFORMANCE.md # docs/features/cli.md # docs/features/metadata-dependencies.md # fixtures/agent-context-conformance/java-kotlin-react-tanstack/expected/.claude/skills/metaobjects-codegen/references/dependencies-and-shared-models.md # fixtures/agent-context-conformance/java-react/expected/.claude/skills/metaobjects-codegen/references/dependencies-and-shared-models.md # fixtures/agent-context-conformance/python/expected/.claude/skills/metaobjects-codegen/references/dependencies-and-shared-models.md # fixtures/agent-context-conformance/ts-react-tanstack/expected/.claude/skills/metaobjects-codegen/references/dependencies-and-shared-models.md # fixtures/agent-context-conformance/ts-requirements/expected/.claude/skills/metaobjects-codegen/references/dependencies-and-shared-models.md # fixtures/dependency-conformance/README.md
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.
What Changed
meta deps sync,meta deps checkandverify --depsnow resolvenpmandpythondependency transports, where beforesyncrefused them as "not supported by this toolchain yet". The newdependency-transports.tsfinds the package the way Node resolves it from the directory holding.metaobjects/, or throughimportlib.util.find_specin the chosen Python interpreter. The interpreter is the first of$METAOBJECTS_PYTHON, the active virtualenv, a.venvbeside.metaobjects/, andpython3, andsyncprints the one it used. The resolveddiris then snapshotted and locked exactly as apathdependency, and the lock format is unchanged. Failures areERR_DEPENDENCY_UNRESOLVED(package not installed, no interpreter, or missingdir) andERR_DEPENDENCY_MANIFEST_INVALID.syncalso warns when the installed package version differs from its manifest version.sharedModelFile()(and its ejectable reference copy) now falls back to a staticpyproject.toml[project]version when nopackage.jsonversion is found. A Python package can therefore stamp the version its consumers install.transport-cases.jsonconformance arm (Node only) with a runner test, two newdependency-conformancecases incases.json, anddeps-sync-packages.test.ts. UpdatedCHANGELOG.md,docs/features/metadata-dependencies.md(two-step npm and Python publish path, plus a private-registry recipe), the README, the CLI and conformance docs, and the regenerated agent-context skill references and their fixtures.Validation
Risk Assessment
✅ Low: The change is bounded to Node
deps sync/check/verify --depstransports plus docs and fixtures. I traced the npm walk, the python interpreter ladder and refusals, the PEP 440 version compare, and the pyproject version fallback; all behave as the intent requires. No private names or absolute paths were added, the case counts reconcile (37 resolution+check cases, 14 transport cases), and the tests assert behavior against independent oracles.Testing
Baseline targeted tests pass (67). Drove the built CLI (
dist/bin/meta.js) against disposable npm and python consumer projects under /tmp, since removed. npm: sync records the lock with resolvedFrom npm, deps check reports current, and an uninstalled package is refused namingnpm install. Python: sync via METAOBJECTS_PYTHON succeeds, a missing VIRTUAL_ENV interpreter is refused even with a working .venv beside the config, a missing module and a dir that escapes the package are refused with the fix named, a parent-import failure says to fix that environment, and a real dist-info version mismatch warns and exits 0. Regression: full CLI packagebun test(1819 tests, 0 fail), SDKdependency-conformance.test.ts(27 pass), Pythontests/conformance/test_dependency_conformance.py(27 pass). Note: the harness sed initially rewrote a config name, a harness error, fixed and re-run.npm install @acme/common-model...)' exit 1pip install acme)' exit 1Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
🔧 **Rebase** - 6 issues found → auto-fixed ✅
CHANGELOG.md- merge conflict rebasing onto origin/maindocs/CONFORMANCE.md- merge conflict rebasing onto origin/maindocs/features/cli.md- merge conflict rebasing onto origin/maindocs/features/metadata-dependencies.md- merge conflict rebasing onto origin/mainfixtures/dependency-conformance/README.md- merge conflict rebasing onto origin/mainfixtures/dependency-conformance/cases.json- merge conflict rebasing onto origin/main🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm install @acme/common-model...)' exit 1pip install acme)' exit 1scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainsbun test test/deps-sync.test.ts test/deps-sync-packages.test.ts test/dependency-transport-conformance.test.ts (server/typescript/packages/cli)bun run build (server/typescript/packages/cli)node dist/bin/meta.js deps sync — npm consumer, installed @acme/common-modelnode dist/bin/meta.js deps check — npm consumer after syncnode dist/bin/meta.js deps sync — npm consumer with package removed (adversarial)node dist/bin/meta.js deps sync — python consumer, METAOBJECTS_PYTHON=/usr/bin/python3node dist/bin/meta.js deps sync — VIRTUAL_ENV set to empty dir with working .venv beside config (adversarial refusal)node dist/bin/meta.js deps sync — python missing module, dir escaping package, parent-import failure (adversarial refusals)node dist/bin/meta.js deps sync — python dist-info version 1.0.0 vs manifest 9.9.9 (version-mismatch warning)bun test (full server/typescript/packages/cli package)bun test test/dependency-conformance.test.ts (server/typescript/packages/sdk)uv run pytest tests/conformance/test_dependency_conformance.py (server/python)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.