vibeman 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/index.js +114 -0
- package/dist/runtime/api/.tsbuildinfo +1 -0
- package/dist/runtime/api/agent/agent-service.d.ts +224 -0
- package/dist/runtime/api/agent/agent-service.js +895 -0
- package/dist/runtime/api/agent/ai-providers/claude-code-adapter.d.ts +61 -0
- package/dist/runtime/api/agent/ai-providers/claude-code-adapter.js +362 -0
- package/dist/runtime/api/agent/ai-providers/codex-cli-provider.d.ts +34 -0
- package/dist/runtime/api/agent/ai-providers/codex-cli-provider.js +315 -0
- package/dist/runtime/api/agent/ai-providers/index.d.ts +9 -0
- package/dist/runtime/api/agent/ai-providers/index.js +7 -0
- package/dist/runtime/api/agent/ai-providers/types.d.ts +182 -0
- package/dist/runtime/api/agent/ai-providers/types.js +5 -0
- package/dist/runtime/api/agent/codex-cli-provider.test.d.ts +1 -0
- package/dist/runtime/api/agent/codex-cli-provider.test.js +125 -0
- package/dist/runtime/api/agent/core-agent-service.d.ts +119 -0
- package/dist/runtime/api/agent/core-agent-service.js +267 -0
- package/dist/runtime/api/agent/parsers.d.ts +16 -0
- package/dist/runtime/api/agent/parsers.js +308 -0
- package/dist/runtime/api/agent/prompt-service.d.ts +30 -0
- package/dist/runtime/api/agent/prompt-service.js +449 -0
- package/dist/runtime/api/agent/prompt-service.test.d.ts +1 -0
- package/dist/runtime/api/agent/prompt-service.test.js +230 -0
- package/dist/runtime/api/agent/routing-policy.d.ts +188 -0
- package/dist/runtime/api/agent/routing-policy.js +246 -0
- package/dist/runtime/api/api/router-helpers.d.ts +32 -0
- package/dist/runtime/api/api/router-helpers.js +31 -0
- package/dist/runtime/api/api/routers/ai.d.ts +188 -0
- package/dist/runtime/api/api/routers/ai.js +395 -0
- package/dist/runtime/api/api/routers/executions.d.ts +98 -0
- package/dist/runtime/api/api/routers/executions.js +94 -0
- package/dist/runtime/api/api/routers/git.d.ts +45 -0
- package/dist/runtime/api/api/routers/git.js +35 -0
- package/dist/runtime/api/api/routers/provider-config.d.ts +165 -0
- package/dist/runtime/api/api/routers/provider-config.js +252 -0
- package/dist/runtime/api/api/routers/settings.d.ts +139 -0
- package/dist/runtime/api/api/routers/settings.js +113 -0
- package/dist/runtime/api/api/routers/tasks.d.ts +141 -0
- package/dist/runtime/api/api/routers/tasks.js +238 -0
- package/dist/runtime/api/api/routers/workflows.d.ts +267 -0
- package/dist/runtime/api/api/routers/workflows.js +310 -0
- package/dist/runtime/api/api/routers/worktrees.d.ts +101 -0
- package/dist/runtime/api/api/routers/worktrees.js +80 -0
- package/dist/runtime/api/api/trpc.d.ts +118 -0
- package/dist/runtime/api/api/trpc.js +34 -0
- package/dist/runtime/api/index.d.ts +9 -0
- package/dist/runtime/api/index.js +117 -0
- package/dist/runtime/api/lib/id-generator.d.ts +70 -0
- package/dist/runtime/api/lib/id-generator.js +123 -0
- package/dist/runtime/api/lib/image-paste-drop-extension.d.ts +26 -0
- package/dist/runtime/api/lib/image-paste-drop-extension.js +125 -0
- package/dist/runtime/api/lib/local-config.d.ts +245 -0
- package/dist/runtime/api/lib/local-config.js +288 -0
- package/dist/runtime/api/lib/logger.d.ts +11 -0
- package/dist/runtime/api/lib/logger.js +188 -0
- package/dist/runtime/api/lib/markdown-utils.d.ts +8 -0
- package/dist/runtime/api/lib/markdown-utils.js +282 -0
- package/dist/runtime/api/lib/markdown-utils.test.d.ts +1 -0
- package/dist/runtime/api/lib/markdown-utils.test.js +348 -0
- package/dist/runtime/api/lib/provider-detection.d.ts +59 -0
- package/dist/runtime/api/lib/provider-detection.js +244 -0
- package/dist/runtime/api/lib/server/agent-service-singleton.d.ts +6 -0
- package/dist/runtime/api/lib/server/agent-service-singleton.js +27 -0
- package/dist/runtime/api/lib/server/bootstrap.d.ts +38 -0
- package/dist/runtime/api/lib/server/bootstrap.js +197 -0
- package/dist/runtime/api/lib/server/git-service-singleton.d.ts +6 -0
- package/dist/runtime/api/lib/server/git-service-singleton.js +47 -0
- package/dist/runtime/api/lib/server/project-root.d.ts +2 -0
- package/dist/runtime/api/lib/server/project-root.js +61 -0
- package/dist/runtime/api/lib/server/task-service-singleton.d.ts +7 -0
- package/dist/runtime/api/lib/server/task-service-singleton.js +58 -0
- package/dist/runtime/api/lib/server/vibing-orchestrator-singleton.d.ts +7 -0
- package/dist/runtime/api/lib/server/vibing-orchestrator-singleton.js +57 -0
- package/dist/runtime/api/lib/tiptap-utils.clamp-selection.test.d.ts +1 -0
- package/dist/runtime/api/lib/tiptap-utils.clamp-selection.test.js +27 -0
- package/dist/runtime/api/lib/tiptap-utils.d.ts +130 -0
- package/dist/runtime/api/lib/tiptap-utils.js +327 -0
- package/dist/runtime/api/lib/trpc/client.d.ts +1 -0
- package/dist/runtime/api/lib/trpc/client.js +5 -0
- package/dist/runtime/api/lib/trpc/server.d.ts +915 -0
- package/dist/runtime/api/lib/trpc/server.js +11 -0
- package/dist/runtime/api/lib/trpc/ws-server.d.ts +8 -0
- package/dist/runtime/api/lib/trpc/ws-server.js +33 -0
- package/dist/runtime/api/persistence/database-service.d.ts +14 -0
- package/dist/runtime/api/persistence/database-service.js +74 -0
- package/dist/runtime/api/persistence/execution-log-persistence.d.ts +90 -0
- package/dist/runtime/api/persistence/execution-log-persistence.js +410 -0
- package/dist/runtime/api/persistence/execution-log-persistence.test.d.ts +1 -0
- package/dist/runtime/api/persistence/execution-log-persistence.test.js +170 -0
- package/dist/runtime/api/router.d.ts +918 -0
- package/dist/runtime/api/router.js +34 -0
- package/dist/runtime/api/settings-service.d.ts +110 -0
- package/dist/runtime/api/settings-service.js +613 -0
- package/dist/runtime/api/tasks/file-watcher.d.ts +23 -0
- package/dist/runtime/api/tasks/file-watcher.js +88 -0
- package/dist/runtime/api/tasks/task-file-parser.d.ts +13 -0
- package/dist/runtime/api/tasks/task-file-parser.js +161 -0
- package/dist/runtime/api/tasks/task-service.d.ts +36 -0
- package/dist/runtime/api/tasks/task-service.js +173 -0
- package/dist/runtime/api/types/index.d.ts +179 -0
- package/dist/runtime/api/types/index.js +1 -0
- package/dist/runtime/api/types/settings.d.ts +81 -0
- package/dist/runtime/api/types/settings.js +2 -0
- package/dist/runtime/api/types.d.ts +2 -0
- package/dist/runtime/api/types.js +1 -0
- package/dist/runtime/api/utils/env.d.ts +6 -0
- package/dist/runtime/api/utils/env.js +12 -0
- package/dist/runtime/api/utils/stripNextEnv.d.ts +7 -0
- package/dist/runtime/api/utils/stripNextEnv.js +22 -0
- package/dist/runtime/api/utils/title-slug.d.ts +6 -0
- package/dist/runtime/api/utils/title-slug.js +77 -0
- package/dist/runtime/api/utils/url.d.ts +2 -0
- package/dist/runtime/api/utils/url.js +19 -0
- package/dist/runtime/api/vcs/git-history-service.d.ts +57 -0
- package/dist/runtime/api/vcs/git-history-service.js +228 -0
- package/dist/runtime/api/vcs/git-service.d.ts +127 -0
- package/dist/runtime/api/vcs/git-service.js +284 -0
- package/dist/runtime/api/vcs/worktree-service.d.ts +93 -0
- package/dist/runtime/api/vcs/worktree-service.js +506 -0
- package/dist/runtime/api/vcs/worktree-service.test.d.ts +1 -0
- package/dist/runtime/api/vcs/worktree-service.test.js +20 -0
- package/dist/runtime/api/workflows/quality-pipeline.d.ts +58 -0
- package/dist/runtime/api/workflows/quality-pipeline.js +400 -0
- package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +318 -0
- package/dist/runtime/api/workflows/vibing-orchestrator.js +1860 -0
- package/dist/runtime/web/.next/BUILD_ID +1 -0
- package/dist/runtime/web/.next/app-build-manifest.json +59 -0
- package/dist/runtime/web/.next/app-path-routes-manifest.json +7 -0
- package/dist/runtime/web/.next/build-manifest.json +33 -0
- package/dist/runtime/web/.next/package.json +1 -0
- package/dist/runtime/web/.next/prerender-manifest.json +61 -0
- package/dist/runtime/web/.next/react-loadable-manifest.json +39 -0
- package/dist/runtime/web/.next/required-server-files.json +334 -0
- package/dist/runtime/web/.next/routes-manifest.json +62 -0
- package/dist/runtime/web/.next/server/app/_not-found/page.js +2 -0
- package/dist/runtime/web/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/dist/runtime/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/dist/runtime/web/.next/server/app/_not-found.html +7 -0
- package/dist/runtime/web/.next/server/app/_not-found.meta +8 -0
- package/dist/runtime/web/.next/server/app/_not-found.rsc +22 -0
- package/dist/runtime/web/.next/server/app/api/health/route.js +1 -0
- package/dist/runtime/web/.next/server/app/api/health/route.js.nft.json +1 -0
- package/dist/runtime/web/.next/server/app/api/health/route_client-reference-manifest.js +1 -0
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js +1 -0
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js.nft.json +1 -0
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route_client-reference-manifest.js +1 -0
- package/dist/runtime/web/.next/server/app/api/upload/route.js +1 -0
- package/dist/runtime/web/.next/server/app/api/upload/route.js.nft.json +1 -0
- package/dist/runtime/web/.next/server/app/api/upload/route_client-reference-manifest.js +1 -0
- package/dist/runtime/web/.next/server/app/index.html +7 -0
- package/dist/runtime/web/.next/server/app/index.meta +7 -0
- package/dist/runtime/web/.next/server/app/index.rsc +27 -0
- package/dist/runtime/web/.next/server/app/page.js +147 -0
- package/dist/runtime/web/.next/server/app/page.js.nft.json +1 -0
- package/dist/runtime/web/.next/server/app/page_client-reference-manifest.js +1 -0
- package/dist/runtime/web/.next/server/app-paths-manifest.json +7 -0
- package/dist/runtime/web/.next/server/chunks/217.js +1 -0
- package/dist/runtime/web/.next/server/chunks/383.js +6 -0
- package/dist/runtime/web/.next/server/chunks/458.js +1 -0
- package/dist/runtime/web/.next/server/chunks/576.js +18 -0
- package/dist/runtime/web/.next/server/chunks/635.js +22 -0
- package/dist/runtime/web/.next/server/chunks/761.js +1 -0
- package/dist/runtime/web/.next/server/chunks/777.js +3 -0
- package/dist/runtime/web/.next/server/chunks/825.js +1 -0
- package/dist/runtime/web/.next/server/chunks/838.js +1 -0
- package/dist/runtime/web/.next/server/chunks/973.js +15 -0
- package/dist/runtime/web/.next/server/functions-config-manifest.json +4 -0
- package/dist/runtime/web/.next/server/middleware-build-manifest.js +1 -0
- package/dist/runtime/web/.next/server/middleware-manifest.json +6 -0
- package/dist/runtime/web/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/dist/runtime/web/.next/server/next-font-manifest.js +1 -0
- package/dist/runtime/web/.next/server/next-font-manifest.json +1 -0
- package/dist/runtime/web/.next/server/pages/404.html +7 -0
- package/dist/runtime/web/.next/server/pages/500.html +1 -0
- package/dist/runtime/web/.next/server/pages/_app.js +1 -0
- package/dist/runtime/web/.next/server/pages/_app.js.nft.json +1 -0
- package/dist/runtime/web/.next/server/pages/_document.js +1 -0
- package/dist/runtime/web/.next/server/pages/_document.js.nft.json +1 -0
- package/dist/runtime/web/.next/server/pages/_error.js +19 -0
- package/dist/runtime/web/.next/server/pages/_error.js.nft.json +1 -0
- package/dist/runtime/web/.next/server/pages-manifest.json +6 -0
- package/dist/runtime/web/.next/server/server-reference-manifest.js +1 -0
- package/dist/runtime/web/.next/server/server-reference-manifest.json +1 -0
- package/dist/runtime/web/.next/server/webpack-runtime.js +1 -0
- package/dist/runtime/web/.next/static/chunks/18-15c10d3288afef2e.js +1 -0
- package/dist/runtime/web/.next/static/chunks/1c0ca389.537bbe362e3ffbd9.js +3 -0
- package/dist/runtime/web/.next/static/chunks/22747d63-ad5da0c19f4cfe41.js +71 -0
- package/dist/runtime/web/.next/static/chunks/277-0142a939f08738c3.js +63 -0
- package/dist/runtime/web/.next/static/chunks/355.056c2645878a799a.js +1 -0
- package/dist/runtime/web/.next/static/chunks/420.a5ccf151c9e2b2f1.js +1 -0
- package/dist/runtime/web/.next/static/chunks/439.1be0c6242fd248d5.js +15 -0
- package/dist/runtime/web/.next/static/chunks/440.c52e7c0f797e22b2.js +1 -0
- package/dist/runtime/web/.next/static/chunks/575-e2478287c27da87b.js +1 -0
- package/dist/runtime/web/.next/static/chunks/691.920d88c115087314.js +1 -0
- package/dist/runtime/web/.next/static/chunks/765-e838910065b50c3d.js +1 -0
- package/dist/runtime/web/.next/static/chunks/87c73c54-09e1ba5c70e60a51.js +1 -0
- package/dist/runtime/web/.next/static/chunks/891cff7f.0f71fc028f87e683.js +1 -0
- package/dist/runtime/web/.next/static/chunks/8bb4d8db-3e2aa02b0a2384b9.js +1 -0
- package/dist/runtime/web/.next/static/chunks/9af238c7-271a911d4e99ab18.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/_not-found/page-1cb74d1cba27d0ab.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/api/health/route-105a61ae865ba536.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-105a61ae865ba536.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/api/upload/route-105a61ae865ba536.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/layout-8435322f09fd0975.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/page-8c3ba579efc6f918.js +1 -0
- package/dist/runtime/web/.next/static/chunks/cac567b0-5b77dd12911823cd.js +1 -0
- package/dist/runtime/web/.next/static/chunks/framework-2518f1345b5b2806.js +1 -0
- package/dist/runtime/web/.next/static/chunks/main-17665e5e39de9a8a.js +1 -0
- package/dist/runtime/web/.next/static/chunks/main-app-c0b0f5ba4f7f9d75.js +1 -0
- package/dist/runtime/web/.next/static/chunks/pages/_app-d6f6b3bbc3d81ee1.js +1 -0
- package/dist/runtime/web/.next/static/chunks/pages/_error-75a96cf1997cc3b9.js +1 -0
- package/dist/runtime/web/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/dist/runtime/web/.next/static/chunks/webpack-c8de37305b4635cf.js +1 -0
- package/dist/runtime/web/.next/static/css/08c950681f1a9a92.css +1 -0
- package/dist/runtime/web/.next/static/css/2728291c68f99cb1.css +3 -0
- package/dist/runtime/web/.next/static/css/521bd69cc298cd1a.css +1 -0
- package/dist/runtime/web/.next/static/css/537e22821e101b87.css +1 -0
- package/dist/runtime/web/.next/static/mRpNgPfbYR_0wrODzlg_4/_buildManifest.js +1 -0
- package/dist/runtime/web/.next/static/mRpNgPfbYR_0wrODzlg_4/_ssgManifest.js +1 -0
- package/dist/runtime/web/.next/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/21350d82a1f187e9-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/ba9851c3c22cd980-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
- package/dist/runtime/web/package.json +65 -0
- package/dist/runtime/web/server.js +44 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +84 -7
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { on, EventEmitter } from 'events';
|
|
3
|
+
import { publicProcedure } from '../trpc.js';
|
|
4
|
+
import { TRPCError } from '@trpc/server';
|
|
5
|
+
export function buildWorkflowRoutes({ vibingOrchestrator }) {
|
|
6
|
+
const OperationOverrideSchema = z.object({
|
|
7
|
+
provider: z.string().optional(),
|
|
8
|
+
model: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
const WorkflowAIRoutingOverrides = z
|
|
11
|
+
.object({
|
|
12
|
+
execute_task: OperationOverrideSchema.optional(),
|
|
13
|
+
improve_task: OperationOverrideSchema.optional(),
|
|
14
|
+
ai_codereview: OperationOverrideSchema.optional(),
|
|
15
|
+
ai_merge: OperationOverrideSchema.optional(),
|
|
16
|
+
})
|
|
17
|
+
.partial();
|
|
18
|
+
const WorkflowConfig = z.object({
|
|
19
|
+
autoQualityChecks: z.boolean().optional(),
|
|
20
|
+
requireHumanApproval: z.boolean().optional(),
|
|
21
|
+
stepByStepMode: z.boolean().optional(),
|
|
22
|
+
autoCommit: z.boolean().optional(),
|
|
23
|
+
createPR: z.boolean().optional(),
|
|
24
|
+
autoMerge: z.boolean().optional(),
|
|
25
|
+
aiCodeReview: z.boolean().optional(),
|
|
26
|
+
aiRoutingOverrides: WorkflowAIRoutingOverrides.optional(),
|
|
27
|
+
});
|
|
28
|
+
const WorkflowConfigOpt = WorkflowConfig.optional();
|
|
29
|
+
return {
|
|
30
|
+
updateWorkflowOptions: publicProcedure
|
|
31
|
+
.input(z.object({ workflowId: z.string(), config: WorkflowConfig }))
|
|
32
|
+
.mutation(async ({ input }) => {
|
|
33
|
+
const orchestrator = vibingOrchestrator;
|
|
34
|
+
await orchestrator.updateWorkflowOptions(input.workflowId, input.config);
|
|
35
|
+
return { success: true };
|
|
36
|
+
}),
|
|
37
|
+
startWorkflow: publicProcedure
|
|
38
|
+
.input(z.object({ taskId: z.string(), config: WorkflowConfigOpt }))
|
|
39
|
+
.mutation(async ({ input }) => {
|
|
40
|
+
const orchestrator = vibingOrchestrator;
|
|
41
|
+
const workflowId = await orchestrator.startWorkflow(input.taskId, input.config || {});
|
|
42
|
+
return { workflowId };
|
|
43
|
+
}),
|
|
44
|
+
continueWorkflow: publicProcedure
|
|
45
|
+
.input(z.object({ workflowId: z.string() }))
|
|
46
|
+
.mutation(async ({ input }) => {
|
|
47
|
+
try {
|
|
48
|
+
const orchestrator = vibingOrchestrator;
|
|
49
|
+
await orchestrator.continueWorkflow(input.workflowId);
|
|
50
|
+
return { success: true };
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
54
|
+
console.error('continueWorkflow failed:', msg);
|
|
55
|
+
throw new TRPCError({ code: 'BAD_REQUEST', message: msg });
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
runValidation: publicProcedure
|
|
59
|
+
.input(z.object({ workflowId: z.string() }))
|
|
60
|
+
.mutation(async ({ input }) => {
|
|
61
|
+
const orchestrator = vibingOrchestrator;
|
|
62
|
+
await orchestrator.runValidation(input.workflowId);
|
|
63
|
+
return { success: true };
|
|
64
|
+
}),
|
|
65
|
+
runMerge: publicProcedure
|
|
66
|
+
.input(z.object({
|
|
67
|
+
workflowId: z.string(),
|
|
68
|
+
provider: z.string().optional(),
|
|
69
|
+
model: z.string().optional(),
|
|
70
|
+
}))
|
|
71
|
+
.mutation(async ({ input }) => {
|
|
72
|
+
const orchestrator = vibingOrchestrator;
|
|
73
|
+
await orchestrator.runMerge(input.workflowId, {
|
|
74
|
+
provider: input.provider,
|
|
75
|
+
model: input.model,
|
|
76
|
+
});
|
|
77
|
+
return { success: true };
|
|
78
|
+
}),
|
|
79
|
+
runCleanup: publicProcedure
|
|
80
|
+
.input(z.object({ workflowId: z.string() }))
|
|
81
|
+
.mutation(async ({ input }) => {
|
|
82
|
+
const orchestrator = vibingOrchestrator;
|
|
83
|
+
await orchestrator.runCleanup(input.workflowId);
|
|
84
|
+
return { success: true };
|
|
85
|
+
}),
|
|
86
|
+
pauseWorkflow: publicProcedure
|
|
87
|
+
.input(z.object({ workflowId: z.string() }))
|
|
88
|
+
.mutation(async ({ input }) => {
|
|
89
|
+
const orchestrator = vibingOrchestrator;
|
|
90
|
+
await orchestrator.pauseWorkflow(input.workflowId);
|
|
91
|
+
return { success: true };
|
|
92
|
+
}),
|
|
93
|
+
resetWorkflow: publicProcedure
|
|
94
|
+
.input(z.object({
|
|
95
|
+
workflowId: z.string(),
|
|
96
|
+
deleteWorktree: z.boolean().optional(),
|
|
97
|
+
force: z.boolean().optional(),
|
|
98
|
+
}))
|
|
99
|
+
.mutation(async ({ input }) => {
|
|
100
|
+
const orchestrator = vibingOrchestrator;
|
|
101
|
+
await orchestrator.resetWorkflow(input.workflowId, {
|
|
102
|
+
deleteWorktree: input.deleteWorktree,
|
|
103
|
+
force: input.force,
|
|
104
|
+
});
|
|
105
|
+
return { success: true };
|
|
106
|
+
}),
|
|
107
|
+
approveWorkflow: publicProcedure
|
|
108
|
+
.input(z.object({ workflowId: z.string(), comments: z.string().optional() }))
|
|
109
|
+
.mutation(async ({ input }) => {
|
|
110
|
+
const orchestrator = vibingOrchestrator;
|
|
111
|
+
await orchestrator.approveWorkflow(input.workflowId);
|
|
112
|
+
return { success: true };
|
|
113
|
+
}),
|
|
114
|
+
rejectWorkflow: publicProcedure
|
|
115
|
+
.input(z.object({ workflowId: z.string(), feedback: z.string() }))
|
|
116
|
+
.mutation(async ({ input }) => {
|
|
117
|
+
const orchestrator = vibingOrchestrator;
|
|
118
|
+
await orchestrator.rejectWorkflow(input.workflowId, input.feedback);
|
|
119
|
+
return { success: true };
|
|
120
|
+
}),
|
|
121
|
+
onTaskWorkflowEvents: publicProcedure
|
|
122
|
+
.input(z.object({ taskId: z.string().optional() }).optional())
|
|
123
|
+
.subscription(async function* (opts) {
|
|
124
|
+
const input = opts.input;
|
|
125
|
+
const orchestrator = vibingOrchestrator;
|
|
126
|
+
const proxy = new EventEmitter();
|
|
127
|
+
const handleStarted = (workflow) => {
|
|
128
|
+
if (!input?.taskId || workflow.taskId === input.taskId)
|
|
129
|
+
proxy.emit('data', { type: 'started', workflowId: workflow.id, workflow });
|
|
130
|
+
};
|
|
131
|
+
const handlePhaseChanged = (data) => {
|
|
132
|
+
if (!input?.taskId || data.workflow?.taskId === input.taskId) {
|
|
133
|
+
// Dedupe terminal phases: completed/failed are emitted via dedicated events
|
|
134
|
+
if (data.newPhase !== 'completed' && data.newPhase !== 'failed') {
|
|
135
|
+
proxy.emit('data', {
|
|
136
|
+
type: 'phase',
|
|
137
|
+
workflowId: data.workflowId,
|
|
138
|
+
phase: data.newPhase,
|
|
139
|
+
workflow: data.workflow,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const handleCompleted = (workflow) => {
|
|
145
|
+
if (!input?.taskId || workflow.taskId === input.taskId)
|
|
146
|
+
proxy.emit('data', { type: 'completed', workflowId: workflow.id, workflow });
|
|
147
|
+
};
|
|
148
|
+
const handleFailed = (workflow) => {
|
|
149
|
+
if (!input?.taskId || workflow.taskId === input.taskId)
|
|
150
|
+
proxy.emit('data', { type: 'failed', workflowId: workflow.id, workflow });
|
|
151
|
+
};
|
|
152
|
+
// New: forward execution start events at the task level
|
|
153
|
+
const handleExecStarted = (data) => {
|
|
154
|
+
if (!input?.taskId || data?.workflow?.taskId === input.taskId) {
|
|
155
|
+
proxy.emit('data', {
|
|
156
|
+
type: 'phase',
|
|
157
|
+
workflowId: data.workflowId,
|
|
158
|
+
phase: data.phase || data.workflow?.phase,
|
|
159
|
+
workflow: data.workflow,
|
|
160
|
+
executionId: data.executionId,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
// Forward additional workflow lifecycle/snapshot events
|
|
165
|
+
const handleUpdated = (workflow) => {
|
|
166
|
+
if (!input?.taskId || workflow.taskId === input.taskId)
|
|
167
|
+
proxy.emit('data', { type: 'updated', workflowId: workflow.id, workflow });
|
|
168
|
+
};
|
|
169
|
+
const handleDeleted = (info) => {
|
|
170
|
+
if (!input?.taskId || info?.taskId === input.taskId)
|
|
171
|
+
proxy.emit('data', { type: 'deleted', workflowId: info.workflowId });
|
|
172
|
+
};
|
|
173
|
+
const handlePaused = (workflow) => {
|
|
174
|
+
if (!input?.taskId || workflow.taskId === input.taskId)
|
|
175
|
+
proxy.emit('data', { type: 'updated', workflowId: workflow.id, workflow });
|
|
176
|
+
};
|
|
177
|
+
const handleOptionsUpdated = (workflow) => {
|
|
178
|
+
if (!input?.taskId || workflow.taskId === input.taskId)
|
|
179
|
+
proxy.emit('data', { type: 'updated', workflowId: workflow.id, workflow });
|
|
180
|
+
};
|
|
181
|
+
orchestrator.on('workflowStarted', handleStarted);
|
|
182
|
+
orchestrator.on('workflowPhaseChanged', handlePhaseChanged);
|
|
183
|
+
orchestrator.on('workflowCompleted', handleCompleted);
|
|
184
|
+
orchestrator.on('workflowFailed', handleFailed);
|
|
185
|
+
orchestrator.on('workflowExecutionStarted', handleExecStarted);
|
|
186
|
+
orchestrator.on('workflowUpdated', handleUpdated);
|
|
187
|
+
orchestrator.on('workflowDeleted', handleDeleted);
|
|
188
|
+
orchestrator.on('workflowPaused', handlePaused);
|
|
189
|
+
orchestrator.on('workflowOptionsUpdated', handleOptionsUpdated);
|
|
190
|
+
try {
|
|
191
|
+
for await (const [payload] of on(proxy, 'data', { signal: opts.signal })) {
|
|
192
|
+
yield payload;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
finally {
|
|
196
|
+
orchestrator.off('workflowStarted', handleStarted);
|
|
197
|
+
orchestrator.off('workflowPhaseChanged', handlePhaseChanged);
|
|
198
|
+
orchestrator.off('workflowCompleted', handleCompleted);
|
|
199
|
+
orchestrator.off('workflowFailed', handleFailed);
|
|
200
|
+
orchestrator.off('workflowExecutionStarted', handleExecStarted);
|
|
201
|
+
orchestrator.off('workflowUpdated', handleUpdated);
|
|
202
|
+
orchestrator.off('workflowDeleted', handleDeleted);
|
|
203
|
+
orchestrator.off('workflowPaused', handlePaused);
|
|
204
|
+
orchestrator.off('workflowOptionsUpdated', handleOptionsUpdated);
|
|
205
|
+
}
|
|
206
|
+
}),
|
|
207
|
+
// Additional workflow helpers used by UI
|
|
208
|
+
getWorkflow: publicProcedure
|
|
209
|
+
.input(z.object({ workflowId: z.string() }))
|
|
210
|
+
.query(async ({ input }) => {
|
|
211
|
+
const orchestrator = vibingOrchestrator;
|
|
212
|
+
return orchestrator.getWorkflow(input.workflowId);
|
|
213
|
+
}),
|
|
214
|
+
getWorkflowsByTaskId: publicProcedure
|
|
215
|
+
.input(z.object({ taskId: z.string() }))
|
|
216
|
+
.query(async ({ input }) => {
|
|
217
|
+
const orchestrator = vibingOrchestrator;
|
|
218
|
+
return orchestrator.getTaskWorkflows(input.taskId);
|
|
219
|
+
}),
|
|
220
|
+
getLatestWorkflowByTaskId: publicProcedure
|
|
221
|
+
.input(z.object({ taskId: z.string() }))
|
|
222
|
+
.query(async ({ input }) => {
|
|
223
|
+
const orchestrator = vibingOrchestrator;
|
|
224
|
+
return orchestrator.getLatestWorkflowByTask(input.taskId);
|
|
225
|
+
}),
|
|
226
|
+
aiReviewCode: publicProcedure
|
|
227
|
+
.input(z.object({
|
|
228
|
+
taskId: z.string(),
|
|
229
|
+
workflowId: z.string().optional(),
|
|
230
|
+
reviewContext: z.string().optional(),
|
|
231
|
+
provider: z.string().optional(),
|
|
232
|
+
model: z.string().optional(),
|
|
233
|
+
}))
|
|
234
|
+
.mutation(async ({ input }) => {
|
|
235
|
+
const orchestrator = vibingOrchestrator;
|
|
236
|
+
const overrides = input.provider || input.model
|
|
237
|
+
? { provider: input.provider, model: input.model }
|
|
238
|
+
: undefined;
|
|
239
|
+
return await orchestrator.aiReviewCode(input.taskId, input.reviewContext, {
|
|
240
|
+
workflowId: input.workflowId,
|
|
241
|
+
overrides,
|
|
242
|
+
});
|
|
243
|
+
}),
|
|
244
|
+
approveAndContinueReview: publicProcedure
|
|
245
|
+
.input(z.object({ workflowId: z.string() }))
|
|
246
|
+
.mutation(async ({ input }) => {
|
|
247
|
+
const orchestrator = vibingOrchestrator;
|
|
248
|
+
await orchestrator.approveAndContinueReview(input.workflowId);
|
|
249
|
+
return { success: true };
|
|
250
|
+
}),
|
|
251
|
+
markCompleted: publicProcedure
|
|
252
|
+
.input(z.object({ workflowId: z.string() }))
|
|
253
|
+
.mutation(async ({ input }) => {
|
|
254
|
+
const orchestrator = vibingOrchestrator;
|
|
255
|
+
await orchestrator.markWorkflowCompleted(input.workflowId);
|
|
256
|
+
return { success: true };
|
|
257
|
+
}),
|
|
258
|
+
checkWorktreeStatus: publicProcedure
|
|
259
|
+
.input(z.object({ workflowId: z.string() }))
|
|
260
|
+
.mutation(async ({ input }) => {
|
|
261
|
+
const orchestrator = vibingOrchestrator;
|
|
262
|
+
return await orchestrator.checkWorktreeStatus(input.workflowId);
|
|
263
|
+
}),
|
|
264
|
+
rerunImplementation: publicProcedure
|
|
265
|
+
.input(z.object({
|
|
266
|
+
workflowId: z.string(),
|
|
267
|
+
feedback: z.string().optional(),
|
|
268
|
+
provider: z.string().optional(),
|
|
269
|
+
model: z.string().optional(),
|
|
270
|
+
}))
|
|
271
|
+
.mutation(async ({ input }) => {
|
|
272
|
+
const orchestrator = vibingOrchestrator;
|
|
273
|
+
await orchestrator.rerunImplementation(input.workflowId, input.feedback, {
|
|
274
|
+
provider: input.provider,
|
|
275
|
+
model: input.model,
|
|
276
|
+
});
|
|
277
|
+
return { success: true };
|
|
278
|
+
}),
|
|
279
|
+
skipToNextPhase: publicProcedure
|
|
280
|
+
.input(z.object({ workflowId: z.string() }))
|
|
281
|
+
.mutation(async ({ input }) => {
|
|
282
|
+
const orchestrator = vibingOrchestrator;
|
|
283
|
+
await orchestrator.skipToNextPhase(input.workflowId);
|
|
284
|
+
return { success: true };
|
|
285
|
+
}),
|
|
286
|
+
rerunFromPhase: publicProcedure
|
|
287
|
+
.input(z.object({
|
|
288
|
+
workflowId: z.string(),
|
|
289
|
+
phase: z.enum([
|
|
290
|
+
'draft',
|
|
291
|
+
'implementing',
|
|
292
|
+
'validating',
|
|
293
|
+
'ai-reviewing',
|
|
294
|
+
'awaiting-review',
|
|
295
|
+
'paused',
|
|
296
|
+
'approved',
|
|
297
|
+
'merging',
|
|
298
|
+
'merged',
|
|
299
|
+
'cleaning',
|
|
300
|
+
'completed',
|
|
301
|
+
'failed',
|
|
302
|
+
]),
|
|
303
|
+
}))
|
|
304
|
+
.mutation(async ({ input }) => {
|
|
305
|
+
const orchestrator = vibingOrchestrator;
|
|
306
|
+
await orchestrator.rerunPhase(input.workflowId, input.phase);
|
|
307
|
+
return { success: true };
|
|
308
|
+
}),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { VibingOrchestrator } from '../../workflows/vibing-orchestrator.js';
|
|
2
|
+
type Deps = {
|
|
3
|
+
vibingOrchestrator: VibingOrchestrator;
|
|
4
|
+
};
|
|
5
|
+
export declare function buildWorktreeRoutes({ vibingOrchestrator }: Deps): {
|
|
6
|
+
readonly listWorktrees: import("@trpc/server").TRPCQueryProcedure<{
|
|
7
|
+
input: void;
|
|
8
|
+
output: (import("../../types/index.js").WorktreeInfo & {
|
|
9
|
+
isConnectedToTask: boolean;
|
|
10
|
+
})[];
|
|
11
|
+
meta: object;
|
|
12
|
+
}>;
|
|
13
|
+
readonly syncWorktreeState: import("@trpc/server").TRPCMutationProcedure<{
|
|
14
|
+
input: void;
|
|
15
|
+
output: {
|
|
16
|
+
readonly success: true;
|
|
17
|
+
readonly message: "Worktree state synchronized";
|
|
18
|
+
};
|
|
19
|
+
meta: object;
|
|
20
|
+
}>;
|
|
21
|
+
readonly getWorktreeInfo: import("@trpc/server").TRPCQueryProcedure<{
|
|
22
|
+
input: {
|
|
23
|
+
taskId: string;
|
|
24
|
+
};
|
|
25
|
+
output: any;
|
|
26
|
+
meta: object;
|
|
27
|
+
}>;
|
|
28
|
+
readonly createWorktree: import("@trpc/server").TRPCMutationProcedure<{
|
|
29
|
+
input: {
|
|
30
|
+
taskId: string;
|
|
31
|
+
};
|
|
32
|
+
output: any;
|
|
33
|
+
meta: object;
|
|
34
|
+
}>;
|
|
35
|
+
readonly deleteWorktree: import("@trpc/server").TRPCMutationProcedure<{
|
|
36
|
+
input: {
|
|
37
|
+
taskId: string;
|
|
38
|
+
force?: boolean | undefined;
|
|
39
|
+
};
|
|
40
|
+
output: {
|
|
41
|
+
readonly success: true;
|
|
42
|
+
};
|
|
43
|
+
meta: object;
|
|
44
|
+
}>;
|
|
45
|
+
readonly openInEditor: import("@trpc/server").TRPCMutationProcedure<{
|
|
46
|
+
input: {
|
|
47
|
+
worktreePath: string;
|
|
48
|
+
};
|
|
49
|
+
output: {
|
|
50
|
+
readonly success: true;
|
|
51
|
+
};
|
|
52
|
+
meta: object;
|
|
53
|
+
}>;
|
|
54
|
+
readonly openInTerminal: import("@trpc/server").TRPCMutationProcedure<{
|
|
55
|
+
input: {
|
|
56
|
+
worktreePath: string;
|
|
57
|
+
};
|
|
58
|
+
output: {
|
|
59
|
+
readonly success: true;
|
|
60
|
+
};
|
|
61
|
+
meta: object;
|
|
62
|
+
}>;
|
|
63
|
+
readonly createWorktreePR: import("@trpc/server").TRPCMutationProcedure<{
|
|
64
|
+
input: {
|
|
65
|
+
taskId: string;
|
|
66
|
+
baseBranch?: string | undefined;
|
|
67
|
+
};
|
|
68
|
+
output: {
|
|
69
|
+
success: boolean;
|
|
70
|
+
pullRequest?: any;
|
|
71
|
+
error?: string;
|
|
72
|
+
};
|
|
73
|
+
meta: object;
|
|
74
|
+
}>;
|
|
75
|
+
readonly createPullRequest: import("@trpc/server").TRPCMutationProcedure<{
|
|
76
|
+
input: {
|
|
77
|
+
taskId: string;
|
|
78
|
+
baseBranch?: string | undefined;
|
|
79
|
+
};
|
|
80
|
+
output: {
|
|
81
|
+
success: boolean;
|
|
82
|
+
pullRequest?: any;
|
|
83
|
+
error?: string;
|
|
84
|
+
};
|
|
85
|
+
meta: object;
|
|
86
|
+
}>;
|
|
87
|
+
readonly cleanupWorktree: import("@trpc/server").TRPCMutationProcedure<{
|
|
88
|
+
input: {
|
|
89
|
+
isConnectedToTask: boolean;
|
|
90
|
+
taskId?: string | undefined;
|
|
91
|
+
force?: boolean | undefined;
|
|
92
|
+
worktreePath?: string | undefined;
|
|
93
|
+
branchName?: string | undefined;
|
|
94
|
+
};
|
|
95
|
+
output: {
|
|
96
|
+
readonly success: true;
|
|
97
|
+
};
|
|
98
|
+
meta: object;
|
|
99
|
+
}>;
|
|
100
|
+
};
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { publicProcedure } from '../trpc.js';
|
|
3
|
+
import { TaskIdSchema, WorktreePathSchema, withErrors } from '../router-helpers.js';
|
|
4
|
+
import { log } from '../../lib/logger.js';
|
|
5
|
+
export function buildWorktreeRoutes({ vibingOrchestrator }) {
|
|
6
|
+
return {
|
|
7
|
+
listWorktrees: publicProcedure.query(withErrors('list worktrees', 'router:listWorktrees', async () => {
|
|
8
|
+
const orchestrator = vibingOrchestrator;
|
|
9
|
+
return await orchestrator.listWorktrees();
|
|
10
|
+
})),
|
|
11
|
+
syncWorktreeState: publicProcedure.mutation(withErrors('sync worktree state', 'router:syncWorktreeState', async () => {
|
|
12
|
+
const orchestrator = vibingOrchestrator;
|
|
13
|
+
await orchestrator.syncWorktreeState();
|
|
14
|
+
return { success: true, message: 'Worktree state synchronized' };
|
|
15
|
+
})),
|
|
16
|
+
getWorktreeInfo: publicProcedure.input(TaskIdSchema).query(async ({ input }) => {
|
|
17
|
+
const orchestrator = vibingOrchestrator;
|
|
18
|
+
const worktree = orchestrator.getWorktreeInfo(input.taskId);
|
|
19
|
+
if (!worktree)
|
|
20
|
+
return null;
|
|
21
|
+
const { git, ...serializableWorktree } = worktree;
|
|
22
|
+
return serializableWorktree;
|
|
23
|
+
}),
|
|
24
|
+
createWorktree: publicProcedure.input(TaskIdSchema).mutation(async ({ input }) => {
|
|
25
|
+
const orchestrator = vibingOrchestrator;
|
|
26
|
+
const worktree = await orchestrator.createWorktree(input.taskId);
|
|
27
|
+
const { git, ...serializableWorktree } = worktree;
|
|
28
|
+
return serializableWorktree;
|
|
29
|
+
}),
|
|
30
|
+
deleteWorktree: publicProcedure
|
|
31
|
+
.input(z.object({ taskId: z.string(), force: z.coerce.boolean().optional() }))
|
|
32
|
+
.mutation(async ({ input }) => {
|
|
33
|
+
const orchestrator = vibingOrchestrator;
|
|
34
|
+
await orchestrator.deleteWorktree(input.taskId, input.force || false);
|
|
35
|
+
if (orchestrator) {
|
|
36
|
+
await orchestrator.removeWorkflowsByTask(input.taskId);
|
|
37
|
+
}
|
|
38
|
+
return { success: true };
|
|
39
|
+
}),
|
|
40
|
+
openInEditor: publicProcedure.input(WorktreePathSchema).mutation(withErrors('open in editor', 'router:openInEditor', async ({ input }) => {
|
|
41
|
+
const orchestrator = vibingOrchestrator;
|
|
42
|
+
await orchestrator.openInEditor(input.worktreePath);
|
|
43
|
+
// Ensure we return a clean, serializable object
|
|
44
|
+
return { success: true };
|
|
45
|
+
})),
|
|
46
|
+
openInTerminal: publicProcedure.input(WorktreePathSchema).mutation(withErrors('open in terminal', 'router:openInTerminal', async ({ input }) => {
|
|
47
|
+
const orchestrator = vibingOrchestrator;
|
|
48
|
+
await orchestrator.openInTerminal(input.worktreePath);
|
|
49
|
+
// Ensure we return a clean, serializable object
|
|
50
|
+
return { success: true };
|
|
51
|
+
})),
|
|
52
|
+
// TODO: Deprecated alias; prefer createPullRequest
|
|
53
|
+
createWorktreePR: publicProcedure
|
|
54
|
+
.input(z.object({ taskId: z.string(), baseBranch: z.string().optional().default('main') }))
|
|
55
|
+
.mutation(async ({ input }) => {
|
|
56
|
+
const orchestrator = vibingOrchestrator;
|
|
57
|
+
log.warn('Deprecated route used: createWorktreePR; prefer createPullRequest', { taskId: input.taskId }, 'router:createWorktreePR');
|
|
58
|
+
return await orchestrator.createPullRequest(input.taskId, input.baseBranch);
|
|
59
|
+
}),
|
|
60
|
+
createPullRequest: publicProcedure
|
|
61
|
+
.input(z.object({ taskId: z.string(), baseBranch: z.string().optional().default('main') }))
|
|
62
|
+
.mutation(withErrors('create pull request', 'router:createPullRequest', async ({ input }) => {
|
|
63
|
+
const orchestrator = vibingOrchestrator;
|
|
64
|
+
return await orchestrator.createPullRequest(input.taskId, input.baseBranch);
|
|
65
|
+
})),
|
|
66
|
+
cleanupWorktree: publicProcedure
|
|
67
|
+
.input(z.object({
|
|
68
|
+
taskId: z.string().optional(),
|
|
69
|
+
worktreePath: z.string().optional(),
|
|
70
|
+
branchName: z.string().optional(),
|
|
71
|
+
isConnectedToTask: z.boolean(),
|
|
72
|
+
force: z.coerce.boolean().optional().default(false),
|
|
73
|
+
}))
|
|
74
|
+
.mutation(async ({ input }) => {
|
|
75
|
+
const orchestrator = vibingOrchestrator;
|
|
76
|
+
await orchestrator.cleanupWorktree(input);
|
|
77
|
+
return { success: true };
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import superjson from 'superjson';
|
|
3
|
+
import type { TaskService } from '../tasks/task-service.js';
|
|
4
|
+
export interface Context {
|
|
5
|
+
taskService?: TaskService;
|
|
6
|
+
}
|
|
7
|
+
export declare const t: import("@trpc/server").TRPCRootObject<Context, object, {
|
|
8
|
+
transformer: typeof superjson;
|
|
9
|
+
}, {
|
|
10
|
+
ctx: Context;
|
|
11
|
+
meta: object;
|
|
12
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
13
|
+
transformer: true;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const router: import("@trpc/server").TRPCRouterBuilder<{
|
|
16
|
+
ctx: Context;
|
|
17
|
+
meta: object;
|
|
18
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
19
|
+
transformer: true;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const publicProcedure: import("@trpc/server").TRPCProcedureBuilder<Context, object, object, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, false>;
|
|
22
|
+
export declare const TaskCreateSchema: z.ZodObject<{
|
|
23
|
+
id: z.ZodOptional<z.ZodString>;
|
|
24
|
+
title: z.ZodString;
|
|
25
|
+
type: z.ZodEnum<["feature", "bug", "chore", "refactor", "test", "doc"]>;
|
|
26
|
+
status: z.ZodDefault<z.ZodEnum<["backlog", "in-progress", "review", "done"]>>;
|
|
27
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
28
|
+
due_date: z.ZodOptional<z.ZodString>;
|
|
29
|
+
assignee: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
30
|
+
priority: z.ZodDefault<z.ZodEnum<["low", "medium", "high"]>>;
|
|
31
|
+
comments: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
32
|
+
content: z.ZodString;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
status: "review" | "in-progress" | "backlog" | "done";
|
|
35
|
+
title: string;
|
|
36
|
+
type: "feature" | "bug" | "chore" | "refactor" | "test" | "doc";
|
|
37
|
+
tags: string[];
|
|
38
|
+
assignee: string[];
|
|
39
|
+
priority: "high" | "medium" | "low";
|
|
40
|
+
comments: string[];
|
|
41
|
+
content: string;
|
|
42
|
+
id?: string | undefined;
|
|
43
|
+
due_date?: string | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
title: string;
|
|
46
|
+
type: "feature" | "bug" | "chore" | "refactor" | "test" | "doc";
|
|
47
|
+
content: string;
|
|
48
|
+
status?: "review" | "in-progress" | "backlog" | "done" | undefined;
|
|
49
|
+
id?: string | undefined;
|
|
50
|
+
tags?: string[] | undefined;
|
|
51
|
+
due_date?: string | undefined;
|
|
52
|
+
assignee?: string[] | undefined;
|
|
53
|
+
priority?: "high" | "medium" | "low" | undefined;
|
|
54
|
+
comments?: string[] | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const TaskUpdateSchema: z.ZodObject<{
|
|
57
|
+
title: z.ZodOptional<z.ZodString>;
|
|
58
|
+
type: z.ZodOptional<z.ZodEnum<["feature", "bug", "chore", "refactor", "test", "doc"]>>;
|
|
59
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["backlog", "in-progress", "review", "done"]>>>;
|
|
60
|
+
tags: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
61
|
+
due_date: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
62
|
+
assignee: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
63
|
+
priority: z.ZodOptional<z.ZodDefault<z.ZodEnum<["low", "medium", "high"]>>>;
|
|
64
|
+
comments: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
65
|
+
content: z.ZodOptional<z.ZodString>;
|
|
66
|
+
} & {
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
deleted_at: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
id: string;
|
|
71
|
+
status?: "review" | "in-progress" | "backlog" | "done" | undefined;
|
|
72
|
+
title?: string | undefined;
|
|
73
|
+
type?: "feature" | "bug" | "chore" | "refactor" | "test" | "doc" | undefined;
|
|
74
|
+
tags?: string[] | undefined;
|
|
75
|
+
due_date?: string | undefined;
|
|
76
|
+
assignee?: string[] | undefined;
|
|
77
|
+
priority?: "high" | "medium" | "low" | undefined;
|
|
78
|
+
comments?: string[] | undefined;
|
|
79
|
+
content?: string | undefined;
|
|
80
|
+
deleted_at?: string | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
id: string;
|
|
83
|
+
status?: "review" | "in-progress" | "backlog" | "done" | undefined;
|
|
84
|
+
title?: string | undefined;
|
|
85
|
+
type?: "feature" | "bug" | "chore" | "refactor" | "test" | "doc" | undefined;
|
|
86
|
+
tags?: string[] | undefined;
|
|
87
|
+
due_date?: string | undefined;
|
|
88
|
+
assignee?: string[] | undefined;
|
|
89
|
+
priority?: "high" | "medium" | "low" | undefined;
|
|
90
|
+
comments?: string[] | undefined;
|
|
91
|
+
content?: string | undefined;
|
|
92
|
+
deleted_at?: string | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
export declare const TaskFilterSchema: z.ZodObject<{
|
|
95
|
+
status: z.ZodOptional<z.ZodEnum<["backlog", "in-progress", "review", "done"]>>;
|
|
96
|
+
type: z.ZodOptional<z.ZodEnum<["feature", "bug", "chore", "refactor", "test", "doc"]>>;
|
|
97
|
+
priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
98
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
99
|
+
search: z.ZodOptional<z.ZodString>;
|
|
100
|
+
includeDeleted: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
onlyDeleted: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
status?: "review" | "in-progress" | "backlog" | "done" | undefined;
|
|
104
|
+
type?: "feature" | "bug" | "chore" | "refactor" | "test" | "doc" | undefined;
|
|
105
|
+
tags?: string[] | undefined;
|
|
106
|
+
priority?: "high" | "medium" | "low" | undefined;
|
|
107
|
+
search?: string | undefined;
|
|
108
|
+
includeDeleted?: boolean | undefined;
|
|
109
|
+
onlyDeleted?: boolean | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
status?: "review" | "in-progress" | "backlog" | "done" | undefined;
|
|
112
|
+
type?: "feature" | "bug" | "chore" | "refactor" | "test" | "doc" | undefined;
|
|
113
|
+
tags?: string[] | undefined;
|
|
114
|
+
priority?: "high" | "medium" | "low" | undefined;
|
|
115
|
+
search?: string | undefined;
|
|
116
|
+
includeDeleted?: boolean | undefined;
|
|
117
|
+
onlyDeleted?: boolean | undefined;
|
|
118
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { initTRPC } from '@trpc/server';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import superjson from 'superjson';
|
|
4
|
+
export const t = initTRPC.context().create({
|
|
5
|
+
transformer: superjson,
|
|
6
|
+
});
|
|
7
|
+
export const router = t.router;
|
|
8
|
+
export const publicProcedure = t.procedure;
|
|
9
|
+
// Input validation schemas
|
|
10
|
+
export const TaskCreateSchema = z.object({
|
|
11
|
+
id: z.string().optional(), // Made optional - will be auto-generated if not provided
|
|
12
|
+
title: z.string(),
|
|
13
|
+
type: z.enum(['feature', 'bug', 'chore', 'refactor', 'test', 'doc']),
|
|
14
|
+
status: z.enum(['backlog', 'in-progress', 'review', 'done']).default('backlog'),
|
|
15
|
+
tags: z.array(z.string()).default([]),
|
|
16
|
+
due_date: z.string().optional(),
|
|
17
|
+
assignee: z.array(z.string()).default([]),
|
|
18
|
+
priority: z.enum(['low', 'medium', 'high']).default('medium'),
|
|
19
|
+
comments: z.array(z.string()).default([]),
|
|
20
|
+
content: z.string(),
|
|
21
|
+
});
|
|
22
|
+
export const TaskUpdateSchema = TaskCreateSchema.partial().extend({
|
|
23
|
+
id: z.string(),
|
|
24
|
+
deleted_at: z.string().optional(),
|
|
25
|
+
});
|
|
26
|
+
export const TaskFilterSchema = z.object({
|
|
27
|
+
status: z.enum(['backlog', 'in-progress', 'review', 'done']).optional(),
|
|
28
|
+
type: z.enum(['feature', 'bug', 'chore', 'refactor', 'test', 'doc']).optional(),
|
|
29
|
+
priority: z.enum(['low', 'medium', 'high']).optional(),
|
|
30
|
+
tags: z.array(z.string()).optional(),
|
|
31
|
+
search: z.string().optional(),
|
|
32
|
+
includeDeleted: z.boolean().optional(),
|
|
33
|
+
onlyDeleted: z.boolean().optional(),
|
|
34
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starts a standalone HTTP server that serves tRPC over HTTP and WebSocket on the same port.
|
|
3
|
+
* HTTP endpoint: /trpc
|
|
4
|
+
* WebSocket path: /trpc
|
|
5
|
+
*/
|
|
6
|
+
export declare function startApiServer({ port, host }: {
|
|
7
|
+
port: number;
|
|
8
|
+
host: string;
|
|
9
|
+
}): Promise<void>;
|