* refactor(query): deepen runtime context, native adapter, and cli output seams * chore(changeset): add fragment for query seam deepening continuation * refactor(query): converge internal command-resolution imports on canonical seam * refactor(query): remove dead seam wrappers and converge on canonical modules * docs(architecture): update context and adr for query seam completion * fix(query): preserve gsd-tools stderr in cli output and clarify static ws test scope * test(query): cover whitespace stderr and null exitCode fallback
30 lines
721 B
TypeScript
30 lines
721 B
TypeScript
import { findProjectRoot } from './helpers.js';
|
|
import { validateWorkstreamName } from '../workstream-utils.js';
|
|
|
|
export interface QueryRuntimeContextInput {
|
|
projectDir: string;
|
|
ws?: string;
|
|
}
|
|
|
|
export interface QueryRuntimeContext {
|
|
projectDir: string;
|
|
ws?: string;
|
|
}
|
|
|
|
export function resolveQueryRuntimeContext(input: QueryRuntimeContextInput): QueryRuntimeContext {
|
|
const projectDir = findProjectRoot(input.projectDir);
|
|
|
|
if (input.ws !== undefined) {
|
|
return {
|
|
projectDir,
|
|
ws: validateWorkstreamName(input.ws) ? input.ws : undefined,
|
|
};
|
|
}
|
|
|
|
const envWs = process.env.GSD_WORKSTREAM;
|
|
return {
|
|
projectDir,
|
|
ws: envWs && validateWorkstreamName(envWs) ? envWs : undefined,
|
|
};
|
|
}
|