@locusai/shared 0.1.6 → 0.2.1
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/CHANGELOG.md +41 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/schemas.d.ts +154 -9
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +73 -1
- package/package.json +1 -1
- package/src/common.ts +106 -0
- package/src/enums.ts +56 -0
- package/src/index.ts +3 -2
- package/src/models/activity.ts +237 -0
- package/src/models/agent.ts +13 -0
- package/src/models/auth.ts +188 -0
- package/src/models/ci.ts +21 -0
- package/src/models/doc-group.ts +42 -0
- package/src/models/doc.ts +66 -0
- package/src/models/index.ts +12 -0
- package/src/models/invitation.ts +83 -0
- package/src/models/organization.ts +105 -0
- package/src/models/sprint.ts +71 -0
- package/src/models/task.ts +110 -0
- package/src/models/user.ts +35 -0
- package/src/models/workspace.ts +90 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/schemas.ts +0 -69
- package/src/types.ts +0 -112
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @locusai/shared
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Update app versions
|
|
8
|
+
|
|
9
|
+
## 0.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 52d35dd: # 🚀 The "Hybrid Agent" Release
|
|
14
|
+
|
|
15
|
+
This release introduces the new **Hybrid Architecture** for Locus, allowing autonomous agents to execute code locally while coordinating via the cloud.
|
|
16
|
+
|
|
17
|
+
## Major Highlights
|
|
18
|
+
|
|
19
|
+
### @locusai/cli
|
|
20
|
+
|
|
21
|
+
- **New `locus run` command**: Starts the local agent runtime that connects to the cloud.
|
|
22
|
+
- **Improved `locus index`**: Now creates a semantic map of your codebase for better agent context.
|
|
23
|
+
- **Removed MCP Server**: The standalone MCP server (`locus serve`) has been replaced by the direct agent runtime.
|
|
24
|
+
- **Terminal UI**: Enhanced CLI output with emoji status indicators and clear lifecycle phases.
|
|
25
|
+
|
|
26
|
+
### @locusai/sdk
|
|
27
|
+
|
|
28
|
+
- **Agent Orchestrator**: New core engine that manages the agent lifecycle (Dispatch -> Plan -> Execute -> Verify).
|
|
29
|
+
- **Sprint Mindmaps**: Agents now generate high-level technical plans for sprints before executing individual tasks.
|
|
30
|
+
- **Anthropic & Claude CLI Support**: Native integration with Claude for planning and coding.
|
|
31
|
+
- **Artifact Syncing**: Automatically syncs locally generated plans and docs to the Locus Dashboard.
|
|
32
|
+
|
|
33
|
+
### @locusai/shared
|
|
34
|
+
|
|
35
|
+
- Updated schemas to support the new `Agent` and `Orchestrator` models.
|
|
36
|
+
- Added `Sprint.mindmap` and `Sprint.mindmapUpdatedAt` fields.
|
|
37
|
+
|
|
38
|
+
## 0.1.7
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- - Workflow improvements
|
|
43
|
+
|
|
3
44
|
## 0.1.6
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
1
|
+
export * from "./common";
|
|
2
|
+
export * from "./enums";
|
|
3
|
+
export * from "./models";
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1,6 +1,130 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { AssigneeRole, TaskPriority, TaskStatus } from "./
|
|
2
|
+
import { AssigneeRole, MembershipRole, TaskPriority, TaskStatus, UserRole } from "./enums";
|
|
3
|
+
export declare const OrganizationSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
slug: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
name: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
}, {
|
|
10
|
+
name: string;
|
|
11
|
+
slug: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const OrganizationUpdateSchema: z.ZodObject<{
|
|
14
|
+
name: z.ZodOptional<z.ZodString>;
|
|
15
|
+
avatarUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
name?: string | undefined;
|
|
18
|
+
avatarUrl?: string | null | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
name?: string | undefined;
|
|
21
|
+
avatarUrl?: string | null | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const ProjectSchema: z.ZodObject<{
|
|
24
|
+
orgId: z.ZodString;
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
slug: z.ZodString;
|
|
27
|
+
description: z.ZodOptional<z.ZodString>;
|
|
28
|
+
repoUrl: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
name: string;
|
|
31
|
+
orgId: string;
|
|
32
|
+
slug: string;
|
|
33
|
+
description?: string | undefined;
|
|
34
|
+
repoUrl?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
name: string;
|
|
37
|
+
orgId: string;
|
|
38
|
+
slug: string;
|
|
39
|
+
description?: string | undefined;
|
|
40
|
+
repoUrl?: string | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const ProjectUpdateSchema: z.ZodObject<{
|
|
43
|
+
name: z.ZodOptional<z.ZodString>;
|
|
44
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
45
|
+
repoUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
name?: string | undefined;
|
|
48
|
+
description?: string | null | undefined;
|
|
49
|
+
repoUrl?: string | null | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
name?: string | undefined;
|
|
52
|
+
description?: string | null | undefined;
|
|
53
|
+
repoUrl?: string | null | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
export declare const UserSchema: z.ZodObject<{
|
|
56
|
+
email: z.ZodString;
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
59
|
+
role: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof UserRole>>>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
email: string;
|
|
62
|
+
name: string;
|
|
63
|
+
role: UserRole;
|
|
64
|
+
avatarUrl?: string | undefined;
|
|
65
|
+
}, {
|
|
66
|
+
email: string;
|
|
67
|
+
name: string;
|
|
68
|
+
avatarUrl?: string | undefined;
|
|
69
|
+
role?: UserRole | undefined;
|
|
70
|
+
}>;
|
|
71
|
+
export declare const MembershipSchema: z.ZodObject<{
|
|
72
|
+
userId: z.ZodString;
|
|
73
|
+
orgId: z.ZodString;
|
|
74
|
+
role: z.ZodDefault<z.ZodNativeEnum<typeof MembershipRole>>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
role: MembershipRole;
|
|
77
|
+
orgId: string;
|
|
78
|
+
userId: string;
|
|
79
|
+
}, {
|
|
80
|
+
orgId: string;
|
|
81
|
+
userId: string;
|
|
82
|
+
role?: MembershipRole | undefined;
|
|
83
|
+
}>;
|
|
84
|
+
export declare const APIKeySchema: z.ZodObject<{
|
|
85
|
+
projectId: z.ZodString;
|
|
86
|
+
name: z.ZodString;
|
|
87
|
+
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
name: string;
|
|
90
|
+
projectId: string;
|
|
91
|
+
expiresAt?: number | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
name: string;
|
|
94
|
+
projectId: string;
|
|
95
|
+
expiresAt?: number | undefined;
|
|
96
|
+
}>;
|
|
97
|
+
export declare const DocumentSchema: z.ZodObject<{
|
|
98
|
+
projectId: z.ZodString;
|
|
99
|
+
path: z.ZodString;
|
|
100
|
+
title: z.ZodString;
|
|
101
|
+
content: z.ZodString;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
path: string;
|
|
104
|
+
title: string;
|
|
105
|
+
projectId: string;
|
|
106
|
+
content: string;
|
|
107
|
+
}, {
|
|
108
|
+
path: string;
|
|
109
|
+
title: string;
|
|
110
|
+
projectId: string;
|
|
111
|
+
content: string;
|
|
112
|
+
}>;
|
|
113
|
+
export declare const DocumentUpdateSchema: z.ZodObject<{
|
|
114
|
+
path: z.ZodOptional<z.ZodString>;
|
|
115
|
+
title: z.ZodOptional<z.ZodString>;
|
|
116
|
+
content: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
path?: string | undefined;
|
|
119
|
+
title?: string | undefined;
|
|
120
|
+
content?: string | undefined;
|
|
121
|
+
}, {
|
|
122
|
+
path?: string | undefined;
|
|
123
|
+
title?: string | undefined;
|
|
124
|
+
content?: string | undefined;
|
|
125
|
+
}>;
|
|
3
126
|
export declare const TaskSchema: z.ZodObject<{
|
|
127
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
4
128
|
title: z.ZodString;
|
|
5
129
|
description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
6
130
|
status: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof TaskStatus>>>;
|
|
@@ -8,22 +132,27 @@ export declare const TaskSchema: z.ZodObject<{
|
|
|
8
132
|
labels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
9
133
|
assigneeRole: z.ZodOptional<z.ZodNativeEnum<typeof AssigneeRole>>;
|
|
10
134
|
parentId: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
135
|
+
sprintId: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
11
136
|
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
status: TaskStatus;
|
|
12
138
|
title: string;
|
|
13
139
|
description: string;
|
|
14
|
-
status: TaskStatus;
|
|
15
140
|
priority: TaskPriority;
|
|
16
141
|
labels: string[];
|
|
17
142
|
assigneeRole?: AssigneeRole | undefined;
|
|
143
|
+
sprintId?: number | null | undefined;
|
|
18
144
|
parentId?: number | null | undefined;
|
|
145
|
+
projectId?: string | undefined;
|
|
19
146
|
}, {
|
|
20
147
|
title: string;
|
|
21
|
-
description?: string | undefined;
|
|
22
148
|
status?: TaskStatus | undefined;
|
|
149
|
+
description?: string | undefined;
|
|
23
150
|
priority?: TaskPriority | undefined;
|
|
24
151
|
labels?: string[] | undefined;
|
|
25
152
|
assigneeRole?: AssigneeRole | undefined;
|
|
153
|
+
sprintId?: number | null | undefined;
|
|
26
154
|
parentId?: number | null | undefined;
|
|
155
|
+
projectId?: string | undefined;
|
|
27
156
|
}>;
|
|
28
157
|
export declare const TaskUpdateSchema: z.ZodObject<{
|
|
29
158
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -47,9 +176,9 @@ export declare const TaskUpdateSchema: z.ZodObject<{
|
|
|
47
176
|
done: boolean;
|
|
48
177
|
}>, "many">>;
|
|
49
178
|
}, "strip", z.ZodTypeAny, {
|
|
179
|
+
status?: TaskStatus | undefined;
|
|
50
180
|
title?: string | undefined;
|
|
51
181
|
description?: string | undefined;
|
|
52
|
-
status?: TaskStatus | undefined;
|
|
53
182
|
priority?: TaskPriority | undefined;
|
|
54
183
|
labels?: string[] | undefined;
|
|
55
184
|
assigneeRole?: AssigneeRole | undefined;
|
|
@@ -60,9 +189,9 @@ export declare const TaskUpdateSchema: z.ZodObject<{
|
|
|
60
189
|
done: boolean;
|
|
61
190
|
}[] | undefined;
|
|
62
191
|
}, {
|
|
192
|
+
status?: TaskStatus | undefined;
|
|
63
193
|
title?: string | undefined;
|
|
64
194
|
description?: string | undefined;
|
|
65
|
-
status?: TaskStatus | undefined;
|
|
66
195
|
priority?: TaskPriority | undefined;
|
|
67
196
|
labels?: string[] | undefined;
|
|
68
197
|
assigneeRole?: AssigneeRole | undefined;
|
|
@@ -73,15 +202,31 @@ export declare const TaskUpdateSchema: z.ZodObject<{
|
|
|
73
202
|
done: boolean;
|
|
74
203
|
}[] | undefined;
|
|
75
204
|
}>;
|
|
205
|
+
export declare const SprintSchema: z.ZodObject<{
|
|
206
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
207
|
+
name: z.ZodString;
|
|
208
|
+
startDate: z.ZodOptional<z.ZodNumber>;
|
|
209
|
+
endDate: z.ZodOptional<z.ZodNumber>;
|
|
210
|
+
}, "strip", z.ZodTypeAny, {
|
|
211
|
+
name: string;
|
|
212
|
+
startDate?: number | undefined;
|
|
213
|
+
endDate?: number | undefined;
|
|
214
|
+
projectId?: string | undefined;
|
|
215
|
+
}, {
|
|
216
|
+
name: string;
|
|
217
|
+
startDate?: number | undefined;
|
|
218
|
+
endDate?: number | undefined;
|
|
219
|
+
projectId?: string | undefined;
|
|
220
|
+
}>;
|
|
76
221
|
export declare const CommentSchema: z.ZodObject<{
|
|
77
222
|
author: z.ZodString;
|
|
78
223
|
text: z.ZodString;
|
|
79
224
|
}, "strip", z.ZodTypeAny, {
|
|
80
|
-
text: string;
|
|
81
225
|
author: string;
|
|
82
|
-
}, {
|
|
83
226
|
text: string;
|
|
227
|
+
}, {
|
|
84
228
|
author: string;
|
|
229
|
+
text: string;
|
|
85
230
|
}>;
|
|
86
231
|
export declare const LockSchema: z.ZodObject<{
|
|
87
232
|
agentId: z.ZodString;
|
|
@@ -108,15 +253,15 @@ export declare const ArtifactSchema: z.ZodObject<{
|
|
|
108
253
|
fileName: z.ZodOptional<z.ZodString>;
|
|
109
254
|
createdBy: z.ZodString;
|
|
110
255
|
}, "strip", z.ZodTypeAny, {
|
|
111
|
-
title: string;
|
|
112
256
|
type: string;
|
|
257
|
+
title: string;
|
|
113
258
|
createdBy: string;
|
|
114
259
|
contentText?: string | undefined;
|
|
115
260
|
fileBase64?: string | undefined;
|
|
116
261
|
fileName?: string | undefined;
|
|
117
262
|
}, {
|
|
118
|
-
title: string;
|
|
119
263
|
type: string;
|
|
264
|
+
title: string;
|
|
120
265
|
createdBy: string;
|
|
121
266
|
contentText?: string | undefined;
|
|
122
267
|
fileBase64?: string | undefined;
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,QAAQ,EACT,MAAM,SAAS,CAAC;AAMjB,eAAO,MAAM,kBAAkB;;;;;;;;;EAO7B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;EAGnC,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAUxB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;EAKrB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;EAIvB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAKzB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AAMH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUrB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB3B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;EAKvB,CAAC;AAMH,eAAO,MAAM,aAAa;;;;;;;;;EAGxB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;EAGrB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;EAEvB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;EAOzB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;EAE1B,CAAC"}
|
package/dist/schemas.js
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { AssigneeRole, TaskPriority, TaskStatus } from "./
|
|
2
|
+
import { AssigneeRole, MembershipRole, TaskPriority, TaskStatus, UserRole, } from "./enums";
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Multi-tenancy Schemas
|
|
5
|
+
// ============================================================================
|
|
6
|
+
export const OrganizationSchema = z.object({
|
|
7
|
+
name: z.string().min(1).max(100),
|
|
8
|
+
slug: z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(50)
|
|
12
|
+
.regex(/^[a-z0-9-]+$/),
|
|
13
|
+
});
|
|
14
|
+
export const OrganizationUpdateSchema = z.object({
|
|
15
|
+
name: z.string().min(1).max(100).optional(),
|
|
16
|
+
avatarUrl: z.string().url().optional().nullable(),
|
|
17
|
+
});
|
|
18
|
+
export const ProjectSchema = z.object({
|
|
19
|
+
orgId: z.string().uuid(),
|
|
20
|
+
name: z.string().min(1).max(100),
|
|
21
|
+
slug: z
|
|
22
|
+
.string()
|
|
23
|
+
.min(1)
|
|
24
|
+
.max(50)
|
|
25
|
+
.regex(/^[a-z0-9-]+$/),
|
|
26
|
+
description: z.string().max(500).optional(),
|
|
27
|
+
repoUrl: z.string().url().optional(),
|
|
28
|
+
});
|
|
29
|
+
export const ProjectUpdateSchema = z.object({
|
|
30
|
+
name: z.string().min(1).max(100).optional(),
|
|
31
|
+
description: z.string().max(500).optional().nullable(),
|
|
32
|
+
repoUrl: z.string().url().optional().nullable(),
|
|
33
|
+
});
|
|
34
|
+
export const UserSchema = z.object({
|
|
35
|
+
email: z.string().email(),
|
|
36
|
+
name: z.string().min(1).max(100),
|
|
37
|
+
avatarUrl: z.string().url().optional(),
|
|
38
|
+
role: z.nativeEnum(UserRole).optional().default(UserRole.USER),
|
|
39
|
+
});
|
|
40
|
+
export const MembershipSchema = z.object({
|
|
41
|
+
userId: z.string().uuid(),
|
|
42
|
+
orgId: z.string().uuid(),
|
|
43
|
+
role: z.nativeEnum(MembershipRole).default(MembershipRole.MEMBER),
|
|
44
|
+
});
|
|
45
|
+
export const APIKeySchema = z.object({
|
|
46
|
+
projectId: z.string().uuid(),
|
|
47
|
+
name: z.string().min(1).max(100),
|
|
48
|
+
expiresAt: z.number().optional(),
|
|
49
|
+
});
|
|
50
|
+
export const DocumentSchema = z.object({
|
|
51
|
+
projectId: z.string().uuid(),
|
|
52
|
+
path: z.string().min(1).max(500),
|
|
53
|
+
title: z.string().min(1).max(200),
|
|
54
|
+
content: z.string(),
|
|
55
|
+
});
|
|
56
|
+
export const DocumentUpdateSchema = z.object({
|
|
57
|
+
path: z.string().min(1).max(500).optional(),
|
|
58
|
+
title: z.string().min(1).max(200).optional(),
|
|
59
|
+
content: z.string().optional(),
|
|
60
|
+
});
|
|
61
|
+
// ============================================================================
|
|
62
|
+
// Task & Sprint Schemas
|
|
63
|
+
// ============================================================================
|
|
3
64
|
export const TaskSchema = z.object({
|
|
65
|
+
projectId: z.string().uuid().optional(), // Optional for local mode
|
|
4
66
|
title: z.string().min(1),
|
|
5
67
|
description: z.string().optional().default(""),
|
|
6
68
|
status: z.nativeEnum(TaskStatus).optional().default(TaskStatus.BACKLOG),
|
|
@@ -8,6 +70,7 @@ export const TaskSchema = z.object({
|
|
|
8
70
|
labels: z.array(z.string()).optional().default([]),
|
|
9
71
|
assigneeRole: z.nativeEnum(AssigneeRole).optional(),
|
|
10
72
|
parentId: z.number().optional().nullable(),
|
|
73
|
+
sprintId: z.number().optional().nullable(),
|
|
11
74
|
});
|
|
12
75
|
export const TaskUpdateSchema = z.object({
|
|
13
76
|
title: z.string().optional(),
|
|
@@ -25,6 +88,15 @@ export const TaskUpdateSchema = z.object({
|
|
|
25
88
|
}))
|
|
26
89
|
.optional(),
|
|
27
90
|
});
|
|
91
|
+
export const SprintSchema = z.object({
|
|
92
|
+
projectId: z.string().uuid().optional(), // Optional for local mode
|
|
93
|
+
name: z.string().min(1).max(100),
|
|
94
|
+
startDate: z.number().optional(),
|
|
95
|
+
endDate: z.number().optional(),
|
|
96
|
+
});
|
|
97
|
+
// ============================================================================
|
|
98
|
+
// Other Schemas
|
|
99
|
+
// ============================================================================
|
|
28
100
|
export const CommentSchema = z.object({
|
|
29
101
|
author: z.string().min(1),
|
|
30
102
|
text: z.string().min(1),
|
package/package.json
CHANGED
package/src/common.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Base Entity
|
|
5
|
+
// ============================================================================
|
|
6
|
+
|
|
7
|
+
export const BaseEntitySchema = z.object({
|
|
8
|
+
id: z.string().uuid(),
|
|
9
|
+
createdAt: z.union([z.date(), z.number()]),
|
|
10
|
+
updatedAt: z.union([z.date(), z.number()]),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type BaseEntity = z.infer<typeof BaseEntitySchema>;
|
|
14
|
+
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Common API Response Schemas
|
|
17
|
+
// ============================================================================
|
|
18
|
+
|
|
19
|
+
export const PaginationMetaSchema = z.object({
|
|
20
|
+
page: z.number(),
|
|
21
|
+
limit: z.number(),
|
|
22
|
+
total: z.number(),
|
|
23
|
+
totalPages: z.number(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export type PaginationMeta = z.infer<typeof PaginationMetaSchema>;
|
|
27
|
+
|
|
28
|
+
export const PaginationRequestSchema = z.object({
|
|
29
|
+
page: z.coerce.number().int().min(1).default(1),
|
|
30
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type PaginationRequest = z.infer<typeof PaginationRequestSchema>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Special type for cases where 'any' is absolutely necessary.
|
|
37
|
+
* Use this sparingly and document why it's needed.
|
|
38
|
+
*/
|
|
39
|
+
// biome-ignore lint/suspicious/noExplicitAny: We need to use any for this type
|
|
40
|
+
export type $FixMe = any;
|
|
41
|
+
|
|
42
|
+
export const ApiResponseSchema = z.object({
|
|
43
|
+
success: z.boolean(),
|
|
44
|
+
data: z.unknown().optional(),
|
|
45
|
+
error: z
|
|
46
|
+
.object({
|
|
47
|
+
code: z.string(),
|
|
48
|
+
message: z.string(),
|
|
49
|
+
details: z.unknown().optional(),
|
|
50
|
+
})
|
|
51
|
+
.optional(),
|
|
52
|
+
meta: z
|
|
53
|
+
.object({
|
|
54
|
+
pagination: PaginationMetaSchema.optional(),
|
|
55
|
+
timestamp: z.string(),
|
|
56
|
+
path: z.string(),
|
|
57
|
+
})
|
|
58
|
+
.optional(),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export type ApiResponse<T = unknown> = {
|
|
62
|
+
success: boolean;
|
|
63
|
+
data?: T;
|
|
64
|
+
error?: {
|
|
65
|
+
code: string;
|
|
66
|
+
message: string;
|
|
67
|
+
details?: unknown;
|
|
68
|
+
};
|
|
69
|
+
meta?: {
|
|
70
|
+
pagination?: PaginationMeta;
|
|
71
|
+
timestamp: string;
|
|
72
|
+
path: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const SuccessResponseSchema = z.object({
|
|
77
|
+
success: z.literal(true),
|
|
78
|
+
message: z.string().optional(),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const ErrorResponseSchema = z.object({
|
|
82
|
+
success: z.literal(false),
|
|
83
|
+
error: z.object({
|
|
84
|
+
code: z.string(),
|
|
85
|
+
message: z.string(),
|
|
86
|
+
details: z.unknown().optional(),
|
|
87
|
+
}),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// ============================================================================
|
|
91
|
+
// Utility Types
|
|
92
|
+
// ============================================================================
|
|
93
|
+
|
|
94
|
+
export type SuccessResponse = z.infer<typeof SuccessResponseSchema>;
|
|
95
|
+
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Generates a standard v4 UUID
|
|
99
|
+
*/
|
|
100
|
+
export function generateUUID(): string {
|
|
101
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
102
|
+
const r = (Math.random() * 16) | 0;
|
|
103
|
+
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
104
|
+
return v.toString(16);
|
|
105
|
+
});
|
|
106
|
+
}
|
package/src/enums.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export enum UserRole {
|
|
2
|
+
USER = "USER",
|
|
3
|
+
ADMIN = "ADMIN",
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export enum MembershipRole {
|
|
7
|
+
OWNER = "OWNER",
|
|
8
|
+
ADMIN = "ADMIN",
|
|
9
|
+
MEMBER = "MEMBER",
|
|
10
|
+
VIEWER = "VIEWER",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export enum TaskStatus {
|
|
14
|
+
BACKLOG = "BACKLOG",
|
|
15
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
16
|
+
REVIEW = "REVIEW",
|
|
17
|
+
VERIFICATION = "VERIFICATION",
|
|
18
|
+
DONE = "DONE",
|
|
19
|
+
BLOCKED = "BLOCKED",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export enum TaskPriority {
|
|
23
|
+
LOW = "LOW",
|
|
24
|
+
MEDIUM = "MEDIUM",
|
|
25
|
+
HIGH = "HIGH",
|
|
26
|
+
CRITICAL = "CRITICAL",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export enum AssigneeRole {
|
|
30
|
+
BACKEND = "BACKEND",
|
|
31
|
+
FRONTEND = "FRONTEND",
|
|
32
|
+
QA = "QA",
|
|
33
|
+
PM = "PM",
|
|
34
|
+
DESIGN = "DESIGN",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export enum SprintStatus {
|
|
38
|
+
PLANNED = "PLANNED",
|
|
39
|
+
ACTIVE = "ACTIVE",
|
|
40
|
+
COMPLETED = "COMPLETED",
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export enum EventType {
|
|
44
|
+
TASK_CREATED = "TASK_CREATED",
|
|
45
|
+
TASK_UPDATED = "TASK_UPDATED",
|
|
46
|
+
TASK_DELETED = "TASK_DELETED",
|
|
47
|
+
STATUS_CHANGED = "STATUS_CHANGED",
|
|
48
|
+
COMMENT_ADDED = "COMMENT_ADDED",
|
|
49
|
+
CI_RAN = "CI_RAN",
|
|
50
|
+
WORKSPACE_CREATED = "WORKSPACE_CREATED",
|
|
51
|
+
MEMBER_ADDED = "MEMBER_ADDED",
|
|
52
|
+
MEMBER_INVITED = "MEMBER_INVITED",
|
|
53
|
+
SPRINT_CREATED = "SPRINT_CREATED",
|
|
54
|
+
SPRINT_STATUS_CHANGED = "SPRINT_STATUS_CHANGED",
|
|
55
|
+
CHECKLIST_INITIALIZED = "CHECKLIST_INITIALIZED",
|
|
56
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
1
|
+
export * from "./common";
|
|
2
|
+
export * from "./enums";
|
|
3
|
+
export * from "./models";
|