@locusai/server 0.1.5 → 0.1.7
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 +16 -0
- package/package.json +1 -1
- package/src/services/task.service.ts +23 -1
- package/src/task-processor.ts +23 -107
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @locusai/server
|
|
2
2
|
|
|
3
|
+
## 0.1.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- - Workflow improvements
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @locusai/shared@0.1.7
|
|
10
|
+
|
|
11
|
+
## 0.1.6
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- - Fix mcp paths and workflows
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @locusai/shared@0.1.6
|
|
18
|
+
|
|
3
19
|
## 0.1.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -85,7 +85,29 @@ export class TaskService {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
createTask(data: CreateTaskData): number {
|
|
88
|
-
const
|
|
88
|
+
const defaultItems = [
|
|
89
|
+
{ id: `default-lint-${Date.now()}`, text: "bun run lint", done: false },
|
|
90
|
+
{
|
|
91
|
+
id: `default-typecheck-${Date.now()}`,
|
|
92
|
+
text: "bun run typecheck",
|
|
93
|
+
done: false,
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
const currentChecklist = data.acceptanceChecklist || [];
|
|
98
|
+
const hasLint = currentChecklist.some((item) => item.text.includes("lint"));
|
|
99
|
+
const hasTypecheck = currentChecklist.some((item) =>
|
|
100
|
+
item.text.includes("typecheck")
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const mergedChecklist = [...currentChecklist];
|
|
104
|
+
if (!hasLint) mergedChecklist.push(defaultItems[0]);
|
|
105
|
+
if (!hasTypecheck) mergedChecklist.push(defaultItems[1]);
|
|
106
|
+
|
|
107
|
+
const id = this.taskRepo.create({
|
|
108
|
+
...data,
|
|
109
|
+
acceptanceChecklist: mergedChecklist,
|
|
110
|
+
});
|
|
89
111
|
this.eventRepo.create(id, "TASK_CREATED", { title: data.title });
|
|
90
112
|
return id;
|
|
91
113
|
}
|
package/src/task-processor.ts
CHANGED
|
@@ -25,8 +25,6 @@ export class TaskProcessor {
|
|
|
25
25
|
|
|
26
26
|
if (to === "IN_PROGRESS") {
|
|
27
27
|
await this.handleInProgress(taskId);
|
|
28
|
-
} else if (to === "VERIFICATION") {
|
|
29
|
-
await this.handleVerification(taskId);
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
|
|
@@ -56,11 +54,6 @@ export class TaskProcessor {
|
|
|
56
54
|
if (presets.quick && labels.includes("auto-ci")) {
|
|
57
55
|
await this.runCi(taskId, "quick");
|
|
58
56
|
}
|
|
59
|
-
|
|
60
|
-
// 4. Create git branch
|
|
61
|
-
const slug = this.slugify(rawTask.title);
|
|
62
|
-
const branchName = `task/${taskId}-${slug}`;
|
|
63
|
-
await this.createBranch(branchName);
|
|
64
57
|
} catch (err) {
|
|
65
58
|
console.error(
|
|
66
59
|
"[TaskProcessor] Failed to process In Progress transition:",
|
|
@@ -80,20 +73,25 @@ export class TaskProcessor {
|
|
|
80
73
|
## Objective
|
|
81
74
|
${description || "No description provided."}
|
|
82
75
|
|
|
83
|
-
##
|
|
84
|
-
1. [ ] Analyze current codebase for related components.
|
|
85
|
-
2. [ ]
|
|
86
|
-
3. [ ] Implement the core logic.
|
|
87
|
-
4. [ ] Run automated
|
|
88
|
-
|
|
76
|
+
## High-Level Approach
|
|
77
|
+
1. [ ] **Research**: Analyze current codebase for related components and state patterns.
|
|
78
|
+
2. [ ] **Architecture**: Plan the component structure (for frontend) or service logic (for backend).
|
|
79
|
+
3. [ ] **Execution**: Implement the core logic iteratively.
|
|
80
|
+
4. [ ] **Verification**: Run automated checks and perform manual validation.
|
|
81
|
+
|
|
82
|
+
## Locus Design Standards
|
|
83
|
+
- **Aesthetics**: Ensure the UI feels premium (gradients, glassmorphism, modern typography).
|
|
84
|
+
- **Interactivity**: Add subtle micro-animations and smooth transitions.
|
|
85
|
+
- **Standards**: Use local-first principles and strict type safety.
|
|
89
86
|
|
|
90
87
|
## Quality Gates
|
|
91
|
-
- [ ] Code follows project style guidelines.
|
|
88
|
+
- [ ] Code follows project style guidelines and naming conventions.
|
|
92
89
|
- [ ] No regression in existing functionality.
|
|
93
90
|
- [ ] Documentation updated if necessary.
|
|
91
|
+
- [ ] Lint and Typecheck pass successfully.
|
|
94
92
|
|
|
95
93
|
---
|
|
96
|
-
*This
|
|
94
|
+
*This draft was automatically generated by Locus to kickstart your implementation.*
|
|
97
95
|
`.trim();
|
|
98
96
|
|
|
99
97
|
this.db
|
|
@@ -121,6 +119,16 @@ ${description || "No description provided."}
|
|
|
121
119
|
{ id: "step-1", text: "Research & Planning", done: false },
|
|
122
120
|
{ id: "step-2", text: "Implementation", done: false },
|
|
123
121
|
{ id: "step-3", text: "Testing & Verification", done: false },
|
|
122
|
+
{
|
|
123
|
+
id: `quality-lint-${Date.now()}`,
|
|
124
|
+
text: "bun run lint",
|
|
125
|
+
done: false,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: `quality-typecheck-${Date.now()}`,
|
|
129
|
+
text: "bun run typecheck",
|
|
130
|
+
done: false,
|
|
131
|
+
},
|
|
124
132
|
];
|
|
125
133
|
|
|
126
134
|
this.db
|
|
@@ -209,96 +217,4 @@ ${description || "No description provided."}
|
|
|
209
217
|
now
|
|
210
218
|
);
|
|
211
219
|
}
|
|
212
|
-
|
|
213
|
-
private async handleVerification(taskId: string) {
|
|
214
|
-
try {
|
|
215
|
-
const rawTask = this.db
|
|
216
|
-
.prepare("SELECT * FROM tasks WHERE id = ?")
|
|
217
|
-
.get(taskId) as RawTask | undefined;
|
|
218
|
-
if (!rawTask) return;
|
|
219
|
-
|
|
220
|
-
const slug = this.slugify(rawTask.title);
|
|
221
|
-
const branchName = `task/${taskId}-${slug}`;
|
|
222
|
-
|
|
223
|
-
// Create PR (Assumes agent has pushed the branch)
|
|
224
|
-
await this.createPullRequest(
|
|
225
|
-
branchName,
|
|
226
|
-
rawTask.title,
|
|
227
|
-
rawTask.description
|
|
228
|
-
);
|
|
229
|
-
} catch (err) {
|
|
230
|
-
console.error(
|
|
231
|
-
"[TaskProcessor] Failed to process Verification transition:",
|
|
232
|
-
err
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
private slugify(text: string): string {
|
|
238
|
-
return text
|
|
239
|
-
.toLowerCase()
|
|
240
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
241
|
-
.replace(/^-|-$/g, "");
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
private async createBranch(branchName: string) {
|
|
245
|
-
console.log(`[TaskProcessor] Creating branch ${branchName}...`);
|
|
246
|
-
try {
|
|
247
|
-
const checkProc = Bun.spawn(
|
|
248
|
-
["git", "show-ref", "--verify", `refs/heads/${branchName}`],
|
|
249
|
-
{
|
|
250
|
-
cwd: this.config.repoPath,
|
|
251
|
-
stdout: "ignore",
|
|
252
|
-
stderr: "ignore",
|
|
253
|
-
}
|
|
254
|
-
);
|
|
255
|
-
const exists = (await checkProc.exited) === 0;
|
|
256
|
-
|
|
257
|
-
if (!exists) {
|
|
258
|
-
// Create branch from HEAD but DO NOT checkout
|
|
259
|
-
// This is safe for parallel agents working in other directories
|
|
260
|
-
await Bun.spawn(["git", "branch", branchName], {
|
|
261
|
-
cwd: this.config.repoPath,
|
|
262
|
-
stdout: "ignore",
|
|
263
|
-
stderr: "pipe",
|
|
264
|
-
}).exited;
|
|
265
|
-
}
|
|
266
|
-
} catch (error) {
|
|
267
|
-
console.error(`[TaskProcessor] Git branch operation failed: ${error}`);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
private async createPullRequest(
|
|
272
|
-
branchName: string,
|
|
273
|
-
title: string,
|
|
274
|
-
description: string
|
|
275
|
-
) {
|
|
276
|
-
console.log(`[TaskProcessor] Creating PR for ${branchName}...`);
|
|
277
|
-
try {
|
|
278
|
-
// Create PR using gh cli (headless)
|
|
279
|
-
// We assume the branch has been pushed by the agent
|
|
280
|
-
await Bun.spawn(
|
|
281
|
-
[
|
|
282
|
-
"gh",
|
|
283
|
-
"pr",
|
|
284
|
-
"create",
|
|
285
|
-
"--title",
|
|
286
|
-
`[Task] ${title}`,
|
|
287
|
-
"--body",
|
|
288
|
-
description || "Task implementation",
|
|
289
|
-
"--head",
|
|
290
|
-
branchName,
|
|
291
|
-
"--base",
|
|
292
|
-
"master",
|
|
293
|
-
],
|
|
294
|
-
{
|
|
295
|
-
cwd: this.config.repoPath,
|
|
296
|
-
stdout: "ignore",
|
|
297
|
-
stderr: "pipe",
|
|
298
|
-
}
|
|
299
|
-
).exited;
|
|
300
|
-
} catch (error) {
|
|
301
|
-
console.error(`[TaskProcessor] PR creation failed: ${error}`);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
220
|
}
|