mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 21:03:08 +00:00
feat(ui): add React Query hooks for data fetching
- Add useFeatures, useFeature, useAgentOutput for feature data - Add useGitHubIssues, useGitHubPRs, useGitHubValidations, useGitHubIssueComments - Add useClaudeUsage, useCodexUsage with polling intervals - Add useRunningAgents, useRunningAgentsCount - Add useWorktrees, useWorktreeInfo, useWorktreeStatus, useWorktreeDiffs - Add useGlobalSettings, useProjectSettings, useCredentials - Add useAvailableModels, useCodexModels, useOpencodeModels - Add useSessions, useSessionHistory, useSessionQueue - Add useIdeationPrompts, useIdeas - Add CLI status queries (claude, cursor, codex, opencode, github) - Add useCursorPermissionsQuery, useWorkspaceDirectories - Add usePipelineConfig, useSpecFile, useSpecRegenerationStatus Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
39
apps/ui/src/hooks/queries/use-pipeline.ts
Normal file
39
apps/ui/src/hooks/queries/use-pipeline.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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 '@/store/app-store';
|
||||
|
||||
/**
|
||||
* 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,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user