Conversation
📝 WalkthroughWalkthroughThis pull request adds CLI TUI mode detection and context creation functionality ( Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client/CLI
participant Detector as Mode Detector
participant CtxFactory as Context Factory
participant Dashboard as Dashboard Launcher
participant Interactive as Interactive TUI
participant Static as Static Listing
rect rgba(100, 150, 200, 0.5)
Note over Client,Static: Interactive Path
Client->>Detector: detectCliTuiMode(runtime)
Detector-->>Client: mode = 'interactive'
Client->>CtxFactory: createCliTuiContext(options)
CtxFactory-->>Client: ctx (interactive)
Client->>Dashboard: launchDashboard(cas, {ctx, runApp})
Dashboard->>Interactive: runApp(ctx)
Interactive-->>Dashboard: TUI rendered
end
rect rgba(200, 150, 100, 0.5)
Note over Client,Static: Non-Interactive Path
Client->>Detector: detectCliTuiMode(runtime)
Detector-->>Client: mode = 'pipe' or 'static'
Client->>CtxFactory: createCliTuiContext(options)
CtxFactory-->>Client: ctx (non-interactive)
Client->>Dashboard: launchDashboard(cas, {ctx, output})
Dashboard->>Static: printStaticList(cas, output)
Static->>Static: listVault → tab-separated rows
Static->>Client: write to output stream
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/unit/cli/context.test.js (1)
15-40: Add explicit tests forBIJOU_ACCESSIBLEandTERM=dumbbranches.Current coverage is good, but these two branches are part of mode precedence and worth locking with direct tests to prevent regressions.
Suggested test additions
describe('detectCliTuiMode', () => { + it('uses accessible mode when BIJOU_ACCESSIBLE=1', () => { + const mode = detectCliTuiMode(makeRuntime({ + env: { BIJOU_ACCESSIBLE: '1', TERM: 'xterm-256color' }, + })); + expect(mode).toBe('accessible'); + }); + + it('falls back to pipe when TERM is dumb', () => { + const mode = detectCliTuiMode(makeRuntime({ + env: { TERM: 'dumb' }, + })); + expect(mode).toBe('pipe'); + }); + it('stays interactive on a TTY when NO_COLOR is set', () => {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/unit/cli/context.test.js` around lines 15 - 40, Add two explicit unit tests for detectCliTuiMode: one that sets env BIJOU_ACCESSIBLE='1' (with TERM present) and asserts the returned mode is the accessible mode (use detectCliTuiMode with makeRuntime and expect mode === 'accessible' to lock that branch), and another that sets TERM='dumb' (with a TTY stdout) and asserts the returned mode is the static fallback (expect mode === 'static'); place them alongside the existing tests so the BIJOU_ACCESSIBLE and TERM=dumb branches are covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bin/ui/dashboard.js`:
- Around line 285-291: The JSDoc above printStaticList is incorrect—it's
describing an options object but the function signature is async function
printStaticList(cas, output = process.stdout). Update the JSDoc for
printStaticList to match the actual parameters by documenting the first
parameter (cas) and the second parameter (output, defaulting to process.stdout
and of type Pick<NodeJS.WriteStream,'write'> or a WriteStream), remove the
erroneous options block, and ensure types and brief descriptions reference the
exact symbol printStaticList and its parameters.
---
Nitpick comments:
In `@test/unit/cli/context.test.js`:
- Around line 15-40: Add two explicit unit tests for detectCliTuiMode: one that
sets env BIJOU_ACCESSIBLE='1' (with TERM present) and asserts the returned mode
is the accessible mode (use detectCliTuiMode with makeRuntime and expect mode
=== 'accessible' to lock that branch), and another that sets TERM='dumb' (with a
TTY stdout) and asserts the returned mode is the static fallback (expect mode
=== 'static'); place them alongside the existing tests so the BIJOU_ACCESSIBLE
and TERM=dumb branches are covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a0d224d0-e36b-4355-baf1-ba32305914fc
📒 Files selected for processing (14)
bin/ui/context.jsbin/ui/dashboard.jstest/integration/round-trip.test.jstest/integration/vault-cli.test.jstest/unit/cli/context.test.jstest/unit/cli/dashboard.launch.test.jstest/unit/cli/dashboard.test.jstest/unit/domain/services/CasService.compression.test.jstest/unit/domain/services/CasService.empty-file.test.jstest/unit/domain/services/CasService.envelope.test.jstest/unit/domain/services/CasService.kdf.test.jstest/unit/domain/services/rotateVaultPassphrase.test.jstest/unit/facade/ContentAddressableStore.rotation.test.jstest/unit/vault/VaultService.test.js
| * @param {{ | ||
| * ctx?: BijouContext, | ||
| * runApp?: typeof run, | ||
| * output?: Pick<NodeJS.WriteStream, 'write'>, | ||
| * }} [options] | ||
| */ | ||
| async function printStaticList(cas) { | ||
| async function printStaticList(cas, output = process.stdout) { |
There was a problem hiding this comment.
JSDoc for printStaticList does not match its actual parameter.
Line 285 documents an options object, but Line 291 accepts output directly. Please align the doc block with the function signature.
Doc fix
/**
* Print static list for non-TTY environments.
*
* `@param` {ContentAddressableStore} cas
- * `@param` {{
- * ctx?: BijouContext,
- * runApp?: typeof run,
- * output?: Pick<NodeJS.WriteStream, 'write'>,
- * }} [options]
+ * `@param` {Pick<NodeJS.WriteStream, 'write'>} [output]
*/
async function printStaticList(cas, output = process.stdout) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * @param {{ | |
| * ctx?: BijouContext, | |
| * runApp?: typeof run, | |
| * output?: Pick<NodeJS.WriteStream, 'write'>, | |
| * }} [options] | |
| */ | |
| async function printStaticList(cas) { | |
| async function printStaticList(cas, output = process.stdout) { | |
| /** | |
| * Print static list for non-TTY environments. | |
| * | |
| * `@param` {ContentAddressableStore} cas | |
| * `@param` {Pick<NodeJS.WriteStream, 'write'>} [output] | |
| */ | |
| async function printStaticList(cas, output = process.stdout) { |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bin/ui/dashboard.js` around lines 285 - 291, The JSDoc above printStaticList
is incorrect—it's describing an options object but the function signature is
async function printStaticList(cas, output = process.stdout). Update the JSDoc
for printStaticList to match the actual parameters by documenting the first
parameter (cas) and the second parameter (output, defaulting to process.stdout
and of type Pick<NodeJS.WriteStream,'write'> or a WriteStream), remove the
erroneous options block, and ensure types and brief descriptions reference the
exact symbol printStaticList and its parameters.
Summary
NO_COLOR=1launchDashboard()fall back to the static list for non-interactive CLI contexts instead of rendering a one-frame TUITesting
npx eslint .npm testGIT_STUNTS_DOCKER=1 npx vitest run test/integrationbunx vitest run test/unitGIT_STUNTS_DOCKER=1 bunx vitest run test/integrationdeno run -A npm:vitest run test/unitGIT_STUNTS_DOCKER=1 deno run -A npm:vitest run test/integrationNotes
NO_COLOR=1, the Bijou context downgraded topipemode and the dashboard rendered once before exiting.Summary by CodeRabbit
Release Notes
New Features
Tests