mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 08:33:36 +00:00
- Extended SetupAPI interface with 20+ missing methods for Cursor, Codex, OpenCode, Gemini, and Copilot CLI integrations - Fixed WorktreeInfo type to include isCurrent and hasWorktree fields - Added null checks for optional API properties across all hooks - Fixed Feature type conflicts between @automaker/types and local definitions - Added missing CLI status hooks for all providers - Fixed type mismatches in mutation callbacks and event handlers - Removed dead code referencing non-existent GlobalSettings properties - Updated mock implementations in electron.ts for all new API methods Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
/**
|
|
* Pipeline Query Hooks
|
|
*
|
|
* React Query hooks for fetching pipeline configuration.
|
|
*/
|
|
|
|
import { useQuery } from '@tanstack/react-query';
|
|
import { getHttpApiClient } from '@/lib/http-api-client';
|
|
import { queryKeys } from '@/lib/query-keys';
|
|
import { STALE_TIMES } from '@/lib/query-client';
|
|
import type { PipelineConfig } from '@automaker/types';
|
|
|
|
/**
|
|
* Fetch pipeline config for a project
|
|
*
|
|
* @param projectPath - Path to the project
|
|
* @returns Query result with pipeline config
|
|
*
|
|
* @example
|
|
* ```tsx
|
|
* const { data: pipelineConfig, isLoading } = usePipelineConfig(currentProject?.path);
|
|
* ```
|
|
*/
|
|
export function usePipelineConfig(projectPath: string | undefined) {
|
|
return useQuery({
|
|
queryKey: queryKeys.pipeline.config(projectPath ?? ''),
|
|
queryFn: async (): Promise<PipelineConfig | null> => {
|
|
if (!projectPath) throw new Error('No project path');
|
|
const api = getHttpApiClient();
|
|
const result = await api.pipeline.getConfig(projectPath);
|
|
if (!result.success) {
|
|
throw new Error(result.error || 'Failed to fetch pipeline config');
|
|
}
|
|
return result.config ?? null;
|
|
},
|
|
enabled: !!projectPath,
|
|
staleTime: STALE_TIMES.SETTINGS,
|
|
});
|
|
}
|