Skip to content

feat(api): lane component api diff#10298

Draft
luvkapur wants to merge 19 commits intomasterfrom
api-diff-lane-components
Draft

feat(api): lane component api diff#10298
luvkapur wants to merge 19 commits intomasterfrom
api-diff-lane-components

Conversation

@luvkapur
Copy link
Copy Markdown
Member

Proposed Changes

luvkapur and others added 19 commits April 15, 2026 13:13
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add SchemaMain as optional dependency to LaneDiffGenerator to compute
API diff between component versions. Renders API changes (added, removed,
modified exports) in CLI output after file diffs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Allows bit schema diff <component> --lane [lane-name] to compare
a component API on a lane against its main version. When no lane
name is given, uses the current lane.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
LanesMain is injected into SchemaDiffCommand by the lanes provider,
avoiding direct legacyScope access and circular aspect dependencies.
Will re-implement as a clean lane subcommand.
Cleanly instantiated in LanesMain provider with all dependencies
(LanesMain, SchemaMain, ComponentMain, Workspace, ScopeMain).

Usage:
  bit lane api-diff <component>           (current lane vs main)
  bit lane api-diff <component> --lane X  (specified lane vs main)
Will implement as --lane flag on schema diff instead.
SchemaDiffCommand defines the --lane flag and exports a laneDiffHandler
callback. LanesMain registers the handler via cli.getCommand('schema'),
following the same pattern used for subcommands (e.g. envs set/unset).

Usage:
  bit schema diff <component> --lane           (current lane vs main)
  bit schema diff <component> --lane scope/x   (specified lane vs main)
SchemaMain exposes registerLaneDiffHandler() API. LanesMain registers
the handler in its provider, providing lane resolution logic. This
follows the same pattern as subcommand registration (e.g. envs set/unset)
but for flag handlers.

Usage:
  bit schema diff <component> --lane           (current lane vs main)
  bit schema diff <component> --lane scope/x   (specified lane vs main)
… diff --lane

Follows the same pattern as LaneDiffGenerator.generate() which calls
importWithoutDeps for both lane and main versions before loading.
The main version is imported without a lane context, and the lane
version is imported with the lane object so the importer knows
which remote scope to fetch from.
Use ComponentID.fromString() instead of host.idsByPattern() so
the component doesn't need to be in the workspace. Use scope.getMany()
instead of host.getMany() to load from scope after importing.
…hema diff --lane

For fully remote components, the ModelComponent object doesn't exist
locally. Import the component from main first so getModelComponent
can find it and resolve the main head.
When base-version and compare-version are given alongside --lane,
use them instead of auto-resolving from lane/main heads. This allows:
  bit schema diff comp v1 v2 --lane my-lane  (explicit versions)
  bit schema diff comp --lane my-lane         (auto-resolve from heads)
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.

1 participant