fix(cli): show project dir in context build step

This commit is contained in:
Andrey Avtomonov 2026-05-13 15:44:30 +02:00
parent c202202e6b
commit ff2cca8ad4
2 changed files with 12 additions and 1 deletions

View file

@ -168,6 +168,15 @@ describe('renderContextBuildView', () => {
expect(output).toContain('(0/1 · 1m05s)');
});
it('renders project directory when provided', () => {
const state = initViewState([
{ connectionId: 'warehouse', driver: 'postgres', operation: 'scan', debugCommand: '', steps: ['scan'] },
]);
const output = renderContextBuildView(state, { styled: false, projectDir: '/tmp/project' });
expect(output).toContain('Project: /tmp/project');
});
it('renders dynamic separator matching header width', () => {
const state = initViewState([
{ connectionId: 'warehouse', driver: 'postgres', operation: 'scan', debugCommand: '', steps: ['scan'] },
@ -448,6 +457,7 @@ describe('runContextBuild', () => {
const output = io.stdout();
expect(output).toContain('Building KTX context');
expect(output).toContain('Project: /tmp/project');
expect(output).toContain('Primary sources:');
expect(output).toContain('warehouse');
expect(output).toContain('Context sources:');

View file

@ -204,6 +204,7 @@ export function renderContextBuildView(
'',
header,
separator,
...(options.projectDir ? [` Project: ${options.projectDir}`] : []),
...renderTargetGroup('Primary sources', state.primarySources, state.frame, styled, width),
...renderTargetGroup('Context sources', state.contextSources, state.frame, styled, width),
'',
@ -684,7 +685,7 @@ export async function runContextBuild(
}
if (!repainter) {
io.stdout.write(renderContextBuildView(state, { styled: false }));
io.stdout.write(renderContextBuildView(state, { ...viewOpts, styled: false }));
} else {
paint(false);
}