feat(ripple): add bit ripple CLI for Ripple CI management#10261
feat(ripple): add bit ripple CLI for Ripple CI management#10261davidfirst merged 10 commits intomasterfrom
bit ripple CLI for Ripple CI management#10261Conversation
Adds a new aspect (teambit.cloud/ripple) providing CLI access to Ripple CI: - `bit ripple list` — list recent jobs with filters (owner, scope, status, limit) - `bit ripple log [job-id]` — show job details and component build status - `bit ripple errors [job-id]` — show build errors with actual log output - `bit ripple retry [job-id]` — retry a failed job - `bit ripple stop [job-id]` — stop a running job All commands auto-detect the current lane from .bitmap when no job-id is given. Error logs are fetched in parallel from the Ripple SSE endpoint with idle timeouts.
There was a problem hiding this comment.
Pull request overview
Introduces a new core aspect (teambit.cloud/ripple) that adds a bit ripple CLI namespace for interacting with Ripple CI jobs on bit.cloud (list/log/errors/retry/stop), and wires it into Bit’s core aspect manifests so it loads as part of the standard CLI.
Changes:
- Added new
teambit.cloud/rippleaspect withbit ripplecommand + subcommands for job inspection and control. - Registered the new aspect in core aspect manifests and core-aspects IDs list.
- Added the Ripple aspect to the workspace
.bitmap.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| scopes/harmony/testing/load-aspect/core-aspects-ids.json | Adds teambit.cloud/ripple to the generated list of core aspects. |
| scopes/harmony/bit/manifests.ts | Registers RippleAspect in the core manifests map so the aspect loads in Bit CLI. |
| scopes/cloud/ripple/ripple.main.runtime.ts | Implements RippleMain: GraphQL calls, SSE log fetching, lane auto-detection helpers, and CLI registration. |
| scopes/cloud/ripple/ripple.cmd.ts | Adds the top-level bit ripple command entry point. |
| scopes/cloud/ripple/ripple.aspect.ts | Declares the teambit.cloud/ripple aspect ID. |
| scopes/cloud/ripple/ripple-stop.cmd.ts | Implements bit ripple stop subcommand. |
| scopes/cloud/ripple/ripple-retry.cmd.ts | Implements bit ripple retry subcommand. |
| scopes/cloud/ripple/ripple-log.cmd.ts | Implements bit ripple log subcommand. |
| scopes/cloud/ripple/ripple-list.cmd.ts | Implements bit ripple list subcommand. |
| scopes/cloud/ripple/ripple-errors.cmd.ts | Implements bit ripple errors subcommand, including container log parsing. |
| scopes/cloud/ripple/index.ts | Exports the Ripple aspect (and RippleMain type). |
| .bitmap | Tracks the new ripple component under teambit.cloud. |
- Use Workspace API directly (getCurrentLaneId, defaultScope) instead of manually parsing .bitmap and workspace.jsonc - Add null guard for job in json() method of errors command - Remove unused --component flag from errors command - Validate --limit flag in list command
Extract colorPhase, stripComponentVersion, resolveJobId to ripple-utils.ts. Remove unused methods, types, and GQL queries. Fix idleTimer cleanup leak.
- Fix scope.replace('.', '/') to handle multiple dots in scope names
- Improve --owner and --lane option descriptions to match actual behavior
- Throw clear error for invalid --limit values instead of misleading empty results
Switch from teambit.harmony/node to teambit.harmony/envs/core-aspect-env so that Babel's lazy require transform is applied, reducing bootstrap file reads.
…strap reads Move all subcommand classes into ripple.cmd.ts to eliminate 5 separate file reads during bootstrap, bringing the total under the 1050 threshold.
| const response = await fetch(url, { headers, signal: controller.signal }); | ||
| if (!response.ok || !response.body) { | ||
| clearTimeout(hardTimeout); | ||
| return []; | ||
| } | ||
| const reader = response.body.getReader(); | ||
| const decoder = new TextDecoder(); | ||
| let buffer = ''; |
There was a problem hiding this comment.
getContainerLog() reads response.body.getReader() (WHATWG streams). With the repo’s current engines.node >=12.22.0, this will not work in older Node runtimes, and the errors command will fail when fetching logs. Consider aligning the repo’s declared Node support (>=18) or reworking log consumption to a Node stream-compatible implementation.
| const table = new Table({ | ||
| head: [ | ||
| chalk.cyan('Job ID'), | ||
| chalk.cyan('Name'), | ||
| chalk.cyan('Scope'), | ||
| chalk.cyan('Status'), | ||
| chalk.cyan('User'), | ||
| chalk.cyan('Started'), | ||
| chalk.cyan('Duration'), | ||
| ], | ||
| chars: { | ||
| top: '', | ||
| 'top-mid': '', | ||
| 'top-left': '', | ||
| 'top-right': '', | ||
| bottom: '', | ||
| 'bottom-mid': '', | ||
| 'bottom-left': '', | ||
| 'bottom-right': '', | ||
| left: '', | ||
| 'left-mid': '', | ||
| mid: '', | ||
| 'mid-mid': '', | ||
| right: '', | ||
| 'right-mid': '', | ||
| middle: ' ', | ||
| }, | ||
| style: { 'padding-left': 1, 'padding-right': 1 }, | ||
| }); |
There was a problem hiding this comment.
The cli-table rendering configuration (custom chars + padding) is duplicated in multiple places in this file. Consider extracting a small helper (e.g. createCompactTable(head)) to keep table formatting consistent and reduce future maintenance when the layout needs to change.
| const table = new Table({ | ||
| head: [chalk.cyan('Task'), chalk.cyan('Status'), chalk.cyan('Started'), chalk.cyan('Warnings')], | ||
| chars: { | ||
| top: '', | ||
| 'top-mid': '', | ||
| 'top-left': '', | ||
| 'top-right': '', | ||
| bottom: '', | ||
| 'bottom-mid': '', | ||
| 'bottom-left': '', | ||
| 'bottom-right': '', | ||
| left: '', | ||
| 'left-mid': '', | ||
| mid: '', | ||
| 'mid-mid': '', | ||
| right: '', | ||
| 'right-mid': '', | ||
| middle: ' ', | ||
| }, | ||
| style: { 'padding-left': 1, 'padding-right': 1 }, | ||
| }); |
There was a problem hiding this comment.
This file defines another cli-table instance with the same custom chars/style config as the list output above. Extracting a shared helper for table creation would avoid format drift and reduce duplication.
Adds a new
bit ripplecommand with subcommands for managing Ripple CI jobs from the CLI:bit ripple list— list recent jobs with filters (owner, scope, lane, status, user, limit)bit ripple log [job-id]— show job details and per-component build statusbit ripple errors [job-id]— show build errors with actual log output from containersbit ripple retry [job-id]— retry a failed jobbit ripple stop [job-id]— stop a running jobAll commands auto-detect the current lane from
.bitmapwhen no job-id is given. Theerrorscommand fetches container logs in parallel from the Ripple SSE endpoint with idle timeouts for fast response (~5s).New aspect:
teambit.cloud/rippleatscopes/cloud/ripple/.