Skip to content

cli: resolve and install transitive registry dependencies (with tests)#2

Merged
rakibulism merged 1 commit intomainfrom
cdx/find-improvement-opportunities-in-repo-1s1m38
Apr 22, 2026
Merged

cli: resolve and install transitive registry dependencies (with tests)#2
rakibulism merged 1 commit intomainfrom
cdx/find-improvement-opportunities-in-repo-1s1m38

Conversation

@rakibulism
Copy link
Copy Markdown
Owner

Motivation

  • Ensure the add/install flow handles transitive registryDependencies so components/blocks that depend on other registry items are installed in the correct order.
  • Surface a lightweight repo-level opportunities scan to record actionable technical debt and refactor suggestions.

Description

  • Implemented resolveItemWithDependencies in packages/cli/src/registry/resolver.ts to fetch manifests, walk registryDependencies transitively, detect cycles, and return a topologically ordered list of RegistryItems, and adapted resolveItem to use it.
  • Updated the add command in packages/cli/src/commands/add.ts to resolve and install transitive dependencies, build an installed list in the result, and adjust snippet selection to use the final install target.
  • Exported the new resolver symbol in packages/cli/src/registry/index.ts and added/updated tests in packages/cli/src/registry/resolver.test.ts and packages/cli/src/commands/add.test.ts to cover dependency ordering, missing/dependency errors, cycles, and updated install expectations.
  • Added IMPROVEMENT_OPPORTUNITIES.md at repo root with a static scan of code-level opportunities and suggested next steps.

Testing

  • Ran vitest unit tests in packages/cli/src/registry/resolver.test.ts, including dependency ordering, missing-dependency, and cycle detection scenarios, and they passed.
  • Ran vitest unit tests in packages/cli/src/commands/add.test.ts, which were updated to expect dependency installs and additional written files, and they passed.
  • All modified CLI unit tests were executed as part of the updated test suite and succeeded.

Codex Task

@rakibulism rakibulism merged commit d8405b0 into main Apr 22, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a84322825

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +141 to +142
for (const resolvedItem of installPlan) {
const result = await installItem(resolvedItem, {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Block example items from transitive add installs

runAdd rejects hyperframes:example only for the requested item, but this loop installs every resolved dependency without type checks. Because registryDependencies are name-only, a component/block can depend on an example and add will then write example targets (including files like index.html) into an existing project, which can overwrite user content. Add a guard that rejects example-type dependencies before installation.

Useful? React with 👍 / 👎.

Comment on lines +113 to +114
const registryEntry = entryByName.get(itemName);
if (!registryEntry) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Resolve root dependency from the entry already matched

resolveItemWithDependencies first matches the requested name with entries.find(...), but fetching is done through entryByName where later duplicates overwrite earlier ones. If registry.json has duplicate names, the requested root can resolve to a different entry/type than the one that passed the existence check, making installs order-dependent. Use the matched root entry directly (or reject duplicate names up front) to keep resolution deterministic.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant