feat(sdk): deepen package seam for legacy query compatibility (#3419)
* feat(sdk): deepen compatibility seam for legacy profile path * chore(changeset): set PR number for #3419 * test(sdk): make query seam wiring assertion behavioral
This commit is contained in:
5
.changeset/crisp-seams-align.md
Normal file
5
.changeset/crisp-seams-align.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
type: Changed
|
||||
pr: 3419
|
||||
---
|
||||
SDK query compatibility now routes `write-profile` default path and query CLI fallback/error imports through explicit package-seam adapters, reducing install-layout coupling outside `sdk-package-compatibility`.
|
||||
@@ -19,7 +19,7 @@ import { GSDError, ErrorClassification } from '../errors.js';
|
||||
import { detectRuntime, resolveGlobalSkillMarkdownPath } from './helpers.js';
|
||||
import { CLAUDE_INSTRUCTIONS } from './profile-questionnaire-data.js';
|
||||
import type { QueryHandler } from './utils.js';
|
||||
import { resolveBundledTemplatesDir } from '../sdk-package-compatibility.js';
|
||||
import { resolveBundledTemplatesDir, resolveLegacyUserProfilePath } from '../sdk-package-compatibility.js';
|
||||
|
||||
const TEMPLATE_DIR = resolveBundledTemplatesDir();
|
||||
|
||||
@@ -482,7 +482,7 @@ function cmdWriteProfileLogic(
|
||||
|
||||
let outputPath = options.output;
|
||||
if (!outputPath) {
|
||||
outputPath = join(homedir(), '.claude', 'get-shit-done', 'USER-PROFILE.md');
|
||||
outputPath = resolveLegacyUserProfilePath();
|
||||
} else if (!isAbsolute(outputPath)) {
|
||||
outputPath = join(cwd, outputPath);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const dispatchSpy = vi.hoisted(() => vi.fn());
|
||||
const runQueryDispatchSpy = vi.hoisted(() => vi.fn());
|
||||
const resolveGsdToolsPathSeamSpy = vi.hoisted(() => vi.fn(() => '/mock/gsd-tools.cjs'));
|
||||
|
||||
vi.mock('./helpers.js', () => ({
|
||||
findProjectRoot: (projectDir: string) => projectDir,
|
||||
@@ -15,12 +16,18 @@ vi.mock('./query-dispatch.js', () => ({
|
||||
runQueryDispatch: (...args: unknown[]) => runQueryDispatchSpy(...args),
|
||||
}));
|
||||
|
||||
vi.mock('../query-gsd-tools-path.js', () => ({
|
||||
resolveGsdToolsPath: (...args: unknown[]) => resolveGsdToolsPathSeamSpy(...args),
|
||||
}));
|
||||
|
||||
import { runQueryCliCommand } from './query-cli-adapter.js';
|
||||
|
||||
describe('query-cli-adapter', () => {
|
||||
beforeEach(() => {
|
||||
dispatchSpy.mockReset();
|
||||
runQueryDispatchSpy.mockReset();
|
||||
resolveGsdToolsPathSeamSpy.mockReset();
|
||||
resolveGsdToolsPathSeamSpy.mockReturnValue('/mock/gsd-tools.cjs');
|
||||
});
|
||||
|
||||
it('returns validation failure for missing query command', async () => {
|
||||
@@ -55,4 +62,18 @@ describe('query-cli-adapter', () => {
|
||||
queryArgv: ['state', 'show'],
|
||||
});
|
||||
});
|
||||
|
||||
it('wires resolveGsdToolsPath from the query seam module', async () => {
|
||||
runQueryDispatchSpy.mockImplementationOnce(async (input: any) => {
|
||||
expect(typeof input.resolveGsdToolsPath).toBe('function');
|
||||
expect(input.resolveGsdToolsPath('/tmp/project')).toBe('/mock/gsd-tools.cjs');
|
||||
expect(resolveGsdToolsPathSeamSpy).toHaveBeenCalledWith('/tmp/project');
|
||||
return { ok: true, exit_code: 0, stdout: '', stderr: [] };
|
||||
});
|
||||
|
||||
await runQueryCliCommand({
|
||||
projectDir: process.cwd(),
|
||||
queryArgv: ['state', 'show'],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createRegistry } from './index.js';
|
||||
import { runQueryDispatch } from './query-dispatch.js';
|
||||
import { resolveGsdToolsPath } from '../gsd-tools.js';
|
||||
import { resolveGsdToolsPath } from '../query-gsd-tools-path.js';
|
||||
import { resolveQueryRuntimeContext } from './query-runtime-context.js';
|
||||
import { createCommandTopology } from './command-topology.js';
|
||||
import { buildQueryCliOutputFromDispatch, buildQueryCliOutputFromError, type QueryCliAdapterOutput } from './query-cli-output.js';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { GSDToolsError } from '../gsd-tools.js';
|
||||
import { GSDToolsError } from '../gsd-tools-error.js';
|
||||
import { buildQueryCliOutputFromError } from './query-cli-output.js';
|
||||
|
||||
describe('query-cli-output', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GSDError, exitCodeFor } from '../errors.js';
|
||||
import { GSDToolsError } from '../gsd-tools.js';
|
||||
import { GSDToolsError } from '../gsd-tools-error.js';
|
||||
import type { QueryDispatchResult } from './query-dispatch-contract.js';
|
||||
|
||||
export interface QueryCliAdapterOutput {
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
resolveBundledTemplatesDir,
|
||||
resolveGsdToolsPath,
|
||||
resolveLegacyInstallDir,
|
||||
resolveLegacyUserProfilePath,
|
||||
resolveLegacyTemplatesDir,
|
||||
resolveLegacyWorkflowsDir,
|
||||
} from './sdk-package-compatibility.js';
|
||||
@@ -25,6 +26,7 @@ describe('SDK Package Seam Module', () => {
|
||||
expect(resolveLegacyInstallDir(homeDir)).toBe(join(homeDir, '.claude', 'get-shit-done'));
|
||||
expect(resolveLegacyTemplatesDir(homeDir)).toBe(join(homeDir, '.claude', 'get-shit-done', 'templates'));
|
||||
expect(resolveLegacyWorkflowsDir(homeDir)).toBe(join(homeDir, '.claude', 'get-shit-done', 'workflows'));
|
||||
expect(resolveLegacyUserProfilePath(homeDir)).toBe(join(homeDir, '.claude', 'get-shit-done', 'USER-PROFILE.md'));
|
||||
expect(resolveBundledTemplatesDir()).toBe(BUNDLED_GSD_TEMPLATES_DIR);
|
||||
expect(resolveBundledAgentsDir()).toBe(BUNDLED_GSD_AGENTS_DIR);
|
||||
});
|
||||
|
||||
@@ -58,6 +58,10 @@ export function resolveLegacyWorkflowsDir(homeDir: string = homedir()): string {
|
||||
return join(resolveLegacyInstallDir(homeDir), 'workflows');
|
||||
}
|
||||
|
||||
export function resolveLegacyUserProfilePath(homeDir: string = homedir()): string {
|
||||
return join(resolveLegacyInstallDir(homeDir), 'USER-PROFILE.md');
|
||||
}
|
||||
|
||||
export function resolveLegacySkillsDir(homeDir: string = homedir()): string {
|
||||
return join(resolveLegacyInstallDir(homeDir), 'skills');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user