@vibeflow-tools/cli 0.5.1 → 0.6.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 +53 -0
- package/README.md +199 -81
- package/dist/chunk-D6KVQU62.js +7 -0
- package/dist/{cli/chunk-QULSJOW5.js → chunk-NRMCK2HM.js} +4 -4
- package/dist/cli/chunk-D6KVQU62.js +7 -0
- package/dist/{chunk-QULSJOW5.js → cli/chunk-NRMCK2HM.js} +4 -4
- package/dist/cli/{files-H2UIFEPJ.js → files-GOVXPMB5.js} +1 -1
- package/dist/cli/{files-MIDXKOAF.js → files-TKEFFLPI.js} +1 -1
- package/dist/cli/index.js +88 -27952
- package/dist/client/kanban-browser.js +15 -15
- package/dist/client/kanban.css +1 -1
- package/dist/{files-H2UIFEPJ.js → files-GOVXPMB5.js} +1 -1
- package/dist/{files-MIDXKOAF.js → files-TKEFFLPI.js} +1 -1
- package/dist/index.js +88 -27952
- package/package.json +8 -3
- package/dist/chunk-252RNKHM.js +0 -2
- package/dist/chunk-43MUGU6Z.js +0 -67
- package/dist/chunk-4Y62J4KR.js +0 -438
- package/dist/chunk-6ABTC7IA.js +0 -482
- package/dist/chunk-7K2VHAWF.js +0 -569
- package/dist/chunk-BKTZSHJS.js +0 -2
- package/dist/chunk-BQLZVQ4E.js +0 -2
- package/dist/chunk-F57OXWVU.js +0 -33
- package/dist/chunk-I2OSZY66.js +0 -803
- package/dist/chunk-IZB3AHO6.js +0 -6
- package/dist/chunk-JKC6MUZ4.js +0 -558
- package/dist/chunk-KKBXVPTJ.js +0 -2
- package/dist/chunk-LK3IGDR6.js +0 -438
- package/dist/chunk-MKOKIWTN.js +0 -569
- package/dist/chunk-MW4OS3IK.js +0 -438
- package/dist/chunk-NRPOXSY6.js +0 -568
- package/dist/chunk-NUM3G22J.js +0 -569
- package/dist/chunk-O564QSMS.js +0 -569
- package/dist/chunk-OAGEPYIT.js +0 -535
- package/dist/chunk-PHBHAIHA.js +0 -33
- package/dist/chunk-PK737AKV.js +0 -560
- package/dist/chunk-TPDIOJDI.js +0 -7
- package/dist/chunk-TWAAPROG.js +0 -822
- package/dist/chunk-XF2CNPE4.js +0 -803
- package/dist/cli/chunk-252RNKHM.js +0 -2
- package/dist/cli/chunk-43MUGU6Z.js +0 -67
- package/dist/cli/chunk-4Y62J4KR.js +0 -438
- package/dist/cli/chunk-6ABTC7IA.js +0 -482
- package/dist/cli/chunk-7K2VHAWF.js +0 -569
- package/dist/cli/chunk-BKTZSHJS.js +0 -2
- package/dist/cli/chunk-BQLZVQ4E.js +0 -2
- package/dist/cli/chunk-F57OXWVU.js +0 -33
- package/dist/cli/chunk-I2OSZY66.js +0 -803
- package/dist/cli/chunk-IZB3AHO6.js +0 -6
- package/dist/cli/chunk-JKC6MUZ4.js +0 -558
- package/dist/cli/chunk-KKBXVPTJ.js +0 -2
- package/dist/cli/chunk-LK3IGDR6.js +0 -438
- package/dist/cli/chunk-MKOKIWTN.js +0 -569
- package/dist/cli/chunk-MW4OS3IK.js +0 -438
- package/dist/cli/chunk-NRPOXSY6.js +0 -568
- package/dist/cli/chunk-NUM3G22J.js +0 -569
- package/dist/cli/chunk-O564QSMS.js +0 -569
- package/dist/cli/chunk-OAGEPYIT.js +0 -535
- package/dist/cli/chunk-PHBHAIHA.js +0 -33
- package/dist/cli/chunk-PK737AKV.js +0 -560
- package/dist/cli/chunk-TPDIOJDI.js +0 -7
- package/dist/cli/chunk-TWAAPROG.js +0 -822
- package/dist/cli/chunk-XF2CNPE4.js +0 -803
- package/dist/cli/files-27OYPA7W.js +0 -20
- package/dist/cli/files-2TK74THO.js +0 -22
- package/dist/cli/files-3RDDXUOS.js +0 -2
- package/dist/cli/files-7275M2PW.js +0 -20
- package/dist/cli/files-D3YPV7QT.js +0 -20
- package/dist/cli/files-FER4UZ4X.js +0 -22
- package/dist/cli/files-H4FRDKJV.js +0 -22
- package/dist/cli/files-IJZVMROA.js +0 -22
- package/dist/cli/files-IX5QZQHC.js +0 -2
- package/dist/cli/files-JPVPKRMX.js +0 -2
- package/dist/cli/files-KH3UEFN7.js +0 -20
- package/dist/cli/files-LTDT5ZFT.js +0 -22
- package/dist/cli/files-O4WJLFMU.js +0 -2
- package/dist/cli/files-OYO6A6MZ.js +0 -22
- package/dist/cli/files-R6QHQBH4.js +0 -22
- package/dist/cli/files-UCALOYWZ.js +0 -22
- package/dist/cli/files-UWZP7P6B.js +0 -2
- package/dist/cli/files-VIDLQM7Y.js +0 -20
- package/dist/cli/files-X2RDLF3W.js +0 -22
- package/dist/cli/files-XVDNOAZB.js +0 -22
- package/dist/cli/workspace-NB6BACZA.js +0 -12
- package/dist/cli/workspace-X2NGGGTQ.js +0 -12
- package/dist/cli/workspace-X4QXECQQ.js +0 -12
- package/dist/files-27OYPA7W.js +0 -20
- package/dist/files-2TK74THO.js +0 -22
- package/dist/files-3RDDXUOS.js +0 -2
- package/dist/files-7275M2PW.js +0 -20
- package/dist/files-D3YPV7QT.js +0 -20
- package/dist/files-FER4UZ4X.js +0 -22
- package/dist/files-H4FRDKJV.js +0 -22
- package/dist/files-IJZVMROA.js +0 -22
- package/dist/files-IX5QZQHC.js +0 -2
- package/dist/files-JPVPKRMX.js +0 -2
- package/dist/files-KH3UEFN7.js +0 -20
- package/dist/files-LTDT5ZFT.js +0 -22
- package/dist/files-O4WJLFMU.js +0 -2
- package/dist/files-OYO6A6MZ.js +0 -22
- package/dist/files-R6QHQBH4.js +0 -22
- package/dist/files-UCALOYWZ.js +0 -22
- package/dist/files-UWZP7P6B.js +0 -2
- package/dist/files-VIDLQM7Y.js +0 -20
- package/dist/files-X2RDLF3W.js +0 -22
- package/dist/files-XVDNOAZB.js +0 -22
- package/dist/workspace-NB6BACZA.js +0 -12
- package/dist/workspace-X2NGGGTQ.js +0 -12
- package/dist/workspace-X4QXECQQ.js +0 -12
|
@@ -1,560 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/core/files.ts
|
|
4
|
-
import {
|
|
5
|
-
readdirSync as readdirSync2,
|
|
6
|
-
writeFileSync as writeFileSync2,
|
|
7
|
-
readFileSync as readFileSync2,
|
|
8
|
-
unlinkSync as unlinkSync2,
|
|
9
|
-
statSync,
|
|
10
|
-
mkdirSync as mkdirSync2,
|
|
11
|
-
existsSync as existsSync3
|
|
12
|
-
} from "fs";
|
|
13
|
-
import { join as join3, basename, isAbsolute } from "path";
|
|
14
|
-
|
|
15
|
-
// src/core/types.ts
|
|
16
|
-
var PROTO_DIR = ".vibeflow";
|
|
17
|
-
var TASKS_DIR = "tasks";
|
|
18
|
-
var COMMENTS_DIR = "comments";
|
|
19
|
-
var FILES_DIR = "tasks/files";
|
|
20
|
-
var AGENTS_DIR = "agents";
|
|
21
|
-
var SCREENSHOTS_DIR = "tasks/screenshots";
|
|
22
|
-
var CONFIG_FILE = "config.json";
|
|
23
|
-
|
|
24
|
-
// src/core/tasks.ts
|
|
25
|
-
import {
|
|
26
|
-
existsSync as existsSync2,
|
|
27
|
-
readFileSync,
|
|
28
|
-
writeFileSync,
|
|
29
|
-
mkdirSync,
|
|
30
|
-
readdirSync,
|
|
31
|
-
unlinkSync,
|
|
32
|
-
renameSync
|
|
33
|
-
} from "fs";
|
|
34
|
-
import { join as join2, extname } from "path";
|
|
35
|
-
import { randomBytes } from "crypto";
|
|
36
|
-
|
|
37
|
-
// src/core/tasks-legacy.ts
|
|
38
|
-
import { existsSync } from "fs";
|
|
39
|
-
import { join } from "path";
|
|
40
|
-
var VALID_STATUSES = ["backlog", "todo", "in-progress", "review", "done"];
|
|
41
|
-
function parseFrontMatter(content) {
|
|
42
|
-
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
|
|
43
|
-
if (!match) return { frontMatter: {}, body: content.trim() };
|
|
44
|
-
const yaml = match[1];
|
|
45
|
-
const body = match[2].trim();
|
|
46
|
-
const frontMatter = {};
|
|
47
|
-
for (const line of yaml.split("\n")) {
|
|
48
|
-
const colonIdx = line.indexOf(":");
|
|
49
|
-
if (colonIdx === -1) continue;
|
|
50
|
-
const key = line.slice(0, colonIdx).trim();
|
|
51
|
-
let value = line.slice(colonIdx + 1).trim();
|
|
52
|
-
if (value.startsWith("'") && value.endsWith("'") || value.startsWith('"') && value.endsWith('"')) {
|
|
53
|
-
value = value.slice(1, -1);
|
|
54
|
-
}
|
|
55
|
-
frontMatter[key] = value;
|
|
56
|
-
}
|
|
57
|
-
return { frontMatter, body };
|
|
58
|
-
}
|
|
59
|
-
function parseTask(content) {
|
|
60
|
-
const { frontMatter, body } = parseFrontMatter(content);
|
|
61
|
-
if (!frontMatter.id || !frontMatter.selector) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
const titleMatch = body.match(/^#\s+(.+)/m);
|
|
65
|
-
const title = titleMatch ? titleMatch[1].trim() : "Untitled";
|
|
66
|
-
const description = body.replace(/^#\s+.+\n*/m, "").trim();
|
|
67
|
-
return {
|
|
68
|
-
id: frontMatter.id,
|
|
69
|
-
title,
|
|
70
|
-
description,
|
|
71
|
-
status: VALID_STATUSES.includes(frontMatter.status) ? frontMatter.status : "todo",
|
|
72
|
-
url: frontMatter.url || void 0,
|
|
73
|
-
selector: frontMatter.selector,
|
|
74
|
-
cssSelector: frontMatter.cssSelector || void 0,
|
|
75
|
-
file: frontMatter.file || void 0,
|
|
76
|
-
line: frontMatter.line ? Number(frontMatter.line) : void 0,
|
|
77
|
-
col: frontMatter.col ? Number(frontMatter.col) : void 0,
|
|
78
|
-
component: frontMatter.component || void 0,
|
|
79
|
-
type: frontMatter.type || void 0,
|
|
80
|
-
priority: frontMatter.priority || void 0,
|
|
81
|
-
reportBack: frontMatter.reportBack === "true" ? true : void 0,
|
|
82
|
-
created: frontMatter.created || (/* @__PURE__ */ new Date()).toISOString(),
|
|
83
|
-
updated: frontMatter.updated || void 0,
|
|
84
|
-
comments: [],
|
|
85
|
-
files: []
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// src/core/tasks.ts
|
|
90
|
-
function generateTaskId() {
|
|
91
|
-
return randomBytes(15).toString("hex");
|
|
92
|
-
}
|
|
93
|
-
function getTasksDir(projectDir) {
|
|
94
|
-
return join2(projectDir, PROTO_DIR, TASKS_DIR);
|
|
95
|
-
}
|
|
96
|
-
function migrateLegacyTaskAssetFolders(projectDir) {
|
|
97
|
-
const protoRoot = join2(projectDir, PROTO_DIR);
|
|
98
|
-
const legacyFilesDir = join2(protoRoot, "files");
|
|
99
|
-
const nextFilesDir = join2(protoRoot, FILES_DIR);
|
|
100
|
-
const legacyScreenshotsDir = join2(protoRoot, "screenshots");
|
|
101
|
-
const nextScreenshotsDir = join2(protoRoot, SCREENSHOTS_DIR);
|
|
102
|
-
if (existsSync2(legacyFilesDir)) {
|
|
103
|
-
mkdirSync(nextFilesDir, { recursive: true });
|
|
104
|
-
for (const entry of readdirSync(legacyFilesDir)) {
|
|
105
|
-
const from = join2(legacyFilesDir, entry);
|
|
106
|
-
const to = join2(nextFilesDir, entry);
|
|
107
|
-
if (existsSync2(to)) continue;
|
|
108
|
-
try {
|
|
109
|
-
renameSync(from, to);
|
|
110
|
-
} catch {
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (existsSync2(legacyScreenshotsDir)) {
|
|
115
|
-
mkdirSync(nextScreenshotsDir, { recursive: true });
|
|
116
|
-
for (const entry of readdirSync(legacyScreenshotsDir)) {
|
|
117
|
-
const from = join2(legacyScreenshotsDir, entry);
|
|
118
|
-
const to = join2(nextScreenshotsDir, entry);
|
|
119
|
-
if (existsSync2(to)) continue;
|
|
120
|
-
try {
|
|
121
|
-
renameSync(from, to);
|
|
122
|
-
} catch {
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function ensureTaskDirs(projectDir) {
|
|
128
|
-
migrateLegacyTaskAssetFolders(projectDir);
|
|
129
|
-
mkdirSync(getTasksDir(projectDir), { recursive: true });
|
|
130
|
-
mkdirSync(join2(projectDir, PROTO_DIR, SCREENSHOTS_DIR), { recursive: true });
|
|
131
|
-
}
|
|
132
|
-
function getDateSubdir(isoDate) {
|
|
133
|
-
return isoDate.slice(0, 10);
|
|
134
|
-
}
|
|
135
|
-
function getTaskFilePath(projectDir, taskId, created) {
|
|
136
|
-
const tasksDir = getTasksDir(projectDir);
|
|
137
|
-
if (created) {
|
|
138
|
-
return join2(tasksDir, getDateSubdir(created), `${taskId}.json`);
|
|
139
|
-
}
|
|
140
|
-
return join2(tasksDir, `${taskId}.json`);
|
|
141
|
-
}
|
|
142
|
-
function findTaskFilePath(projectDir, taskId) {
|
|
143
|
-
const tasksDir = getTasksDir(projectDir);
|
|
144
|
-
if (!existsSync2(tasksDir)) return null;
|
|
145
|
-
for (const entry of readdirSync(tasksDir, { withFileTypes: true })) {
|
|
146
|
-
if (entry.isDirectory()) {
|
|
147
|
-
const candidate = join2(tasksDir, entry.name, `${taskId}.json`);
|
|
148
|
-
if (existsSync2(candidate)) return candidate;
|
|
149
|
-
} else if (entry.name === `${taskId}.json`) {
|
|
150
|
-
return join2(tasksDir, entry.name);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
function normalizeTask(raw) {
|
|
156
|
-
const normalizedType = (() => {
|
|
157
|
-
if (typeof raw.type !== "string") return void 0;
|
|
158
|
-
const t = raw.type.trim();
|
|
159
|
-
if (!t || t === "[object Object]") return void 0;
|
|
160
|
-
return t;
|
|
161
|
-
})();
|
|
162
|
-
return {
|
|
163
|
-
id: String(raw.id ?? ""),
|
|
164
|
-
title: String(raw.title ?? "Untitled"),
|
|
165
|
-
description: String(raw.description ?? ""),
|
|
166
|
-
status: VALID_STATUSES.includes(raw.status) ? raw.status : "todo",
|
|
167
|
-
url: raw.url ? String(raw.url) : void 0,
|
|
168
|
-
selector: (() => {
|
|
169
|
-
const sel = String(raw.selector ?? "/");
|
|
170
|
-
if (raw.file && !raw.cssSelector && sel.startsWith(String(raw.file))) {
|
|
171
|
-
return raw.url ? String(raw.url) : "/";
|
|
172
|
-
}
|
|
173
|
-
return sel;
|
|
174
|
-
})(),
|
|
175
|
-
cssSelector: raw.cssSelector && String(raw.cssSelector) !== String(raw.selector ?? "/") ? String(raw.cssSelector) : void 0,
|
|
176
|
-
file: raw.file ? String(raw.file) : void 0,
|
|
177
|
-
line: raw.line != null ? Number(raw.line) : void 0,
|
|
178
|
-
col: raw.col != null ? Number(raw.col) : void 0,
|
|
179
|
-
component: raw.component ? String(raw.component) : void 0,
|
|
180
|
-
type: normalizedType,
|
|
181
|
-
priority: raw.priority ? String(raw.priority) : void 0,
|
|
182
|
-
...raw.reportBack === true && { reportBack: true },
|
|
183
|
-
agent: raw.agent ? String(raw.agent) : void 0,
|
|
184
|
-
model: raw.model ? String(raw.model) : void 0,
|
|
185
|
-
author: raw.author ? String(raw.author) : void 0,
|
|
186
|
-
commit: raw.commit ? String(raw.commit) : void 0,
|
|
187
|
-
commits: Array.isArray(raw.commits) ? raw.commits.map((c) => ({
|
|
188
|
-
sha: String(c.sha ?? ""),
|
|
189
|
-
message: String(c.message ?? ""),
|
|
190
|
-
timestamp: String(c.timestamp ?? (/* @__PURE__ */ new Date()).toISOString())
|
|
191
|
-
})) : void 0,
|
|
192
|
-
created: String(raw.created ?? (/* @__PURE__ */ new Date()).toISOString()),
|
|
193
|
-
updated: raw.updated ? String(raw.updated) : void 0,
|
|
194
|
-
comments: Array.isArray(raw.comments) ? raw.comments.map((c) => ({
|
|
195
|
-
...c,
|
|
196
|
-
// Normalize legacy 'content' field → 'text' (some older agent comments used 'content')
|
|
197
|
-
text: c.text ?? c.content ?? ""
|
|
198
|
-
})) : [],
|
|
199
|
-
files: Array.isArray(raw.files) ? raw.files.map((f) => {
|
|
200
|
-
if (typeof f === "string") {
|
|
201
|
-
return { name: f, addedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
202
|
-
}
|
|
203
|
-
return {
|
|
204
|
-
name: String(f.name ?? ""),
|
|
205
|
-
addedAt: String(f.addedAt ?? (/* @__PURE__ */ new Date()).toISOString()),
|
|
206
|
-
linkedPath: f.linkedPath ? String(f.linkedPath) : void 0,
|
|
207
|
-
mimeType: f.mimeType ? String(f.mimeType) : void 0
|
|
208
|
-
};
|
|
209
|
-
}).filter((f) => f.name) : [],
|
|
210
|
-
screenshot: raw.screenshot ? String(raw.screenshot) : void 0,
|
|
211
|
-
annotatedElementText: raw.annotatedElementText ? String(raw.annotatedElementText) : void 0
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
function writeTaskJson(projectDir, task) {
|
|
215
|
-
const dateDir = join2(getTasksDir(projectDir), getDateSubdir(task.created));
|
|
216
|
-
mkdirSync(dateDir, { recursive: true });
|
|
217
|
-
const filePath = join2(dateDir, `${task.id}.json`);
|
|
218
|
-
writeFileSync(filePath, JSON.stringify(task, null, 2), "utf-8");
|
|
219
|
-
}
|
|
220
|
-
function createTask(projectDir, input) {
|
|
221
|
-
const normalizedPriority = (() => {
|
|
222
|
-
const raw = (input.priority ?? "").trim().toLowerCase();
|
|
223
|
-
if (raw === "critical") return "Critical";
|
|
224
|
-
if (raw === "high") return "High";
|
|
225
|
-
if (raw === "low") return "Low";
|
|
226
|
-
return "Medium";
|
|
227
|
-
})();
|
|
228
|
-
const task = {
|
|
229
|
-
...input,
|
|
230
|
-
priority: normalizedPriority,
|
|
231
|
-
id: generateTaskId(),
|
|
232
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
233
|
-
comments: [],
|
|
234
|
-
files: []
|
|
235
|
-
};
|
|
236
|
-
writeTaskJson(projectDir, task);
|
|
237
|
-
return task;
|
|
238
|
-
}
|
|
239
|
-
function readTaskFile(filePath) {
|
|
240
|
-
try {
|
|
241
|
-
const content = readFileSync(filePath, "utf-8");
|
|
242
|
-
if (filePath.endsWith(".json")) {
|
|
243
|
-
const raw = JSON.parse(content);
|
|
244
|
-
if (!raw || typeof raw !== "object" || !("id" in raw)) return null;
|
|
245
|
-
return normalizeTask(raw);
|
|
246
|
-
}
|
|
247
|
-
return parseTask(content);
|
|
248
|
-
} catch {
|
|
249
|
-
return null;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
function collectTaskFiles(projectDir) {
|
|
253
|
-
const tasksDir = getTasksDir(projectDir);
|
|
254
|
-
if (!existsSync2(tasksDir)) return [];
|
|
255
|
-
const results = [];
|
|
256
|
-
for (const entry of readdirSync(tasksDir, { withFileTypes: true })) {
|
|
257
|
-
if (entry.isDirectory()) {
|
|
258
|
-
const dateDir = join2(tasksDir, entry.name);
|
|
259
|
-
for (const file of readdirSync(dateDir)) {
|
|
260
|
-
if (extname(file) === ".json") {
|
|
261
|
-
const filePath = join2(dateDir, file);
|
|
262
|
-
const task = readTaskFile(filePath);
|
|
263
|
-
if (task) results.push({ task, filePath });
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
} else if (extname(entry.name) === ".json") {
|
|
267
|
-
const filePath = join2(tasksDir, entry.name);
|
|
268
|
-
const task = readTaskFile(filePath);
|
|
269
|
-
if (task) results.push({ task, filePath });
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return results.sort((a, b) => {
|
|
273
|
-
const aDate = a.task.updated ?? a.task.created;
|
|
274
|
-
const bDate = b.task.updated ?? b.task.created;
|
|
275
|
-
return new Date(bDate).getTime() - new Date(aDate).getTime();
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
function listTasks(projectDir) {
|
|
279
|
-
return collectTaskFiles(projectDir).map(({ task }) => task);
|
|
280
|
-
}
|
|
281
|
-
function listTasksWithPaths(projectDir) {
|
|
282
|
-
return collectTaskFiles(projectDir).map(({ task, filePath }) => ({ ...task, filePath }));
|
|
283
|
-
}
|
|
284
|
-
function updateTask(projectDir, taskId, updates) {
|
|
285
|
-
const existingPath = findTaskFilePath(projectDir, taskId);
|
|
286
|
-
const task = existingPath ? readTaskFile(existingPath) : null;
|
|
287
|
-
if (!task) return null;
|
|
288
|
-
const updated = { ...task, ...updates, updated: (/* @__PURE__ */ new Date()).toISOString() };
|
|
289
|
-
writeTaskJson(projectDir, updated);
|
|
290
|
-
if (existingPath && existingPath !== getTaskFilePath(projectDir, taskId, updated.created)) {
|
|
291
|
-
try {
|
|
292
|
-
unlinkSync(existingPath);
|
|
293
|
-
} catch {
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return updated;
|
|
297
|
-
}
|
|
298
|
-
function deleteTask(projectDir, taskId) {
|
|
299
|
-
const filePath = findTaskFilePath(projectDir, taskId);
|
|
300
|
-
if (!filePath) return false;
|
|
301
|
-
unlinkSync(filePath);
|
|
302
|
-
return true;
|
|
303
|
-
}
|
|
304
|
-
function formatTaskForAgent(task, comments, files) {
|
|
305
|
-
return {
|
|
306
|
-
id: task.id,
|
|
307
|
-
status: task.status,
|
|
308
|
-
title: task.title,
|
|
309
|
-
description: task.description,
|
|
310
|
-
...task.url && { url: task.url },
|
|
311
|
-
selector: task.selector,
|
|
312
|
-
...task.file && { file: task.file },
|
|
313
|
-
...task.line != null && { line: task.line },
|
|
314
|
-
...task.col != null && { col: task.col },
|
|
315
|
-
...task.component && { component: task.component },
|
|
316
|
-
...task.type && { type: task.type },
|
|
317
|
-
...task.priority && { priority: task.priority },
|
|
318
|
-
...comments && comments.length > 0 && { structuredComments: comments },
|
|
319
|
-
...files && files.length > 0 && { linkedFiles: files },
|
|
320
|
-
...task.reportBack && { reportBack: true },
|
|
321
|
-
created: task.created
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
function migrateTasksFromMd(projectDir) {
|
|
325
|
-
const tasksDir = getTasksDir(projectDir);
|
|
326
|
-
const commentsDir = join2(projectDir, PROTO_DIR, COMMENTS_DIR);
|
|
327
|
-
if (!existsSync2(tasksDir)) return 0;
|
|
328
|
-
const mdFiles = readdirSync(tasksDir).filter((f) => extname(f) === ".md");
|
|
329
|
-
let migrated = 0;
|
|
330
|
-
for (const mdFile of mdFiles) {
|
|
331
|
-
const mdPath = join2(tasksDir, mdFile);
|
|
332
|
-
try {
|
|
333
|
-
const legacyTask = parseTask(readFileSync(mdPath, "utf-8"));
|
|
334
|
-
if (!legacyTask) continue;
|
|
335
|
-
if (findTaskFilePath(projectDir, legacyTask.id)) {
|
|
336
|
-
unlinkSync(mdPath);
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
const commentsPath = join2(commentsDir, `${legacyTask.id}.json`);
|
|
340
|
-
let comments = [];
|
|
341
|
-
if (existsSync2(commentsPath)) {
|
|
342
|
-
try {
|
|
343
|
-
const raw = JSON.parse(readFileSync(commentsPath, "utf-8"));
|
|
344
|
-
if (Array.isArray(raw)) {
|
|
345
|
-
comments = raw.map((c, i) => ({
|
|
346
|
-
...c,
|
|
347
|
-
id: c.id || String(Date.now() + i).slice(-10)
|
|
348
|
-
}));
|
|
349
|
-
}
|
|
350
|
-
} catch {
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
const newTask = {
|
|
354
|
-
...legacyTask,
|
|
355
|
-
comments,
|
|
356
|
-
files: []
|
|
357
|
-
};
|
|
358
|
-
writeTaskJson(projectDir, newTask);
|
|
359
|
-
unlinkSync(mdPath);
|
|
360
|
-
migrated++;
|
|
361
|
-
} catch {
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
return migrated;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// src/core/files.ts
|
|
368
|
-
var LINKED_MANIFEST = ".linked.json";
|
|
369
|
-
function getFilesDir(projectDir, taskId) {
|
|
370
|
-
return join3(projectDir, PROTO_DIR, FILES_DIR, taskId);
|
|
371
|
-
}
|
|
372
|
-
function ensureFilesDir(projectDir, taskId) {
|
|
373
|
-
mkdirSync2(getFilesDir(projectDir, taskId), { recursive: true });
|
|
374
|
-
}
|
|
375
|
-
function readLinked(projectDir, taskId) {
|
|
376
|
-
const manifestPath = join3(getFilesDir(projectDir, taskId), LINKED_MANIFEST);
|
|
377
|
-
if (!existsSync3(manifestPath)) return [];
|
|
378
|
-
try {
|
|
379
|
-
return JSON.parse(readFileSync2(manifestPath, "utf-8"));
|
|
380
|
-
} catch {
|
|
381
|
-
return [];
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
function getTaskFileRefs(projectDir, taskId) {
|
|
385
|
-
const filePath = findTaskFilePath(projectDir, taskId);
|
|
386
|
-
const task = filePath ? readTaskFile(filePath) : null;
|
|
387
|
-
if (!task?.files || task.files.length === 0) return [];
|
|
388
|
-
return task.files;
|
|
389
|
-
}
|
|
390
|
-
function setTaskFileRefs(projectDir, taskId, refs) {
|
|
391
|
-
updateTask(projectDir, taskId, { files: refs });
|
|
392
|
-
}
|
|
393
|
-
function migrateLegacyLinkedRefs(projectDir, taskId) {
|
|
394
|
-
const refs = getTaskFileRefs(projectDir, taskId);
|
|
395
|
-
const manifestPath = join3(getFilesDir(projectDir, taskId), LINKED_MANIFEST);
|
|
396
|
-
if (!existsSync3(manifestPath)) return refs;
|
|
397
|
-
const legacy = readLinked(projectDir, taskId);
|
|
398
|
-
if (legacy.length === 0) {
|
|
399
|
-
try {
|
|
400
|
-
unlinkSync2(manifestPath);
|
|
401
|
-
} catch {
|
|
402
|
-
}
|
|
403
|
-
return refs;
|
|
404
|
-
}
|
|
405
|
-
const next = refs.slice();
|
|
406
|
-
let added = false;
|
|
407
|
-
for (const entry of legacy) {
|
|
408
|
-
if (!next.find((f) => f.linkedPath === entry.path || f.name === entry.name && f.linkedPath)) {
|
|
409
|
-
next.push({
|
|
410
|
-
name: entry.name,
|
|
411
|
-
linkedPath: entry.path,
|
|
412
|
-
addedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
413
|
-
});
|
|
414
|
-
added = true;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
if (added) {
|
|
418
|
-
setTaskFileRefs(projectDir, taskId, next);
|
|
419
|
-
}
|
|
420
|
-
try {
|
|
421
|
-
unlinkSync2(manifestPath);
|
|
422
|
-
} catch {
|
|
423
|
-
}
|
|
424
|
-
return next;
|
|
425
|
-
}
|
|
426
|
-
function listFiles(projectDir, taskId) {
|
|
427
|
-
const dir = getFilesDir(projectDir, taskId);
|
|
428
|
-
const refs = migrateLegacyLinkedRefs(projectDir, taskId);
|
|
429
|
-
const byName = /* @__PURE__ */ new Map();
|
|
430
|
-
for (const ref of refs) {
|
|
431
|
-
if (ref.linkedPath && existsSync3(ref.linkedPath)) {
|
|
432
|
-
const stat = statSync(ref.linkedPath);
|
|
433
|
-
byName.set(ref.name, {
|
|
434
|
-
name: ref.name,
|
|
435
|
-
size: stat.size,
|
|
436
|
-
url: `/api/tasks/${taskId}/files/${encodeURIComponent(ref.name)}`,
|
|
437
|
-
linkedPath: ref.linkedPath,
|
|
438
|
-
createdAt: stat.mtime.toISOString()
|
|
439
|
-
});
|
|
440
|
-
continue;
|
|
441
|
-
}
|
|
442
|
-
const uploadedPath = join3(dir, ref.name);
|
|
443
|
-
if (existsSync3(uploadedPath)) {
|
|
444
|
-
const stat = statSync(uploadedPath);
|
|
445
|
-
byName.set(ref.name, {
|
|
446
|
-
name: ref.name,
|
|
447
|
-
size: stat.size,
|
|
448
|
-
url: `/api/tasks/${taskId}/files/${encodeURIComponent(ref.name)}`,
|
|
449
|
-
createdAt: stat.mtime.toISOString()
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
if (existsSync3(dir)) {
|
|
454
|
-
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
455
|
-
if (!entry.isFile() || entry.name === LINKED_MANIFEST || byName.has(entry.name)) continue;
|
|
456
|
-
const fullPath = join3(dir, entry.name);
|
|
457
|
-
const stat = statSync(fullPath);
|
|
458
|
-
byName.set(entry.name, {
|
|
459
|
-
name: entry.name,
|
|
460
|
-
size: stat.size,
|
|
461
|
-
url: `/api/tasks/${taskId}/files/${encodeURIComponent(entry.name)}`,
|
|
462
|
-
createdAt: stat.mtime.toISOString()
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
return Array.from(byName.values());
|
|
467
|
-
}
|
|
468
|
-
function saveFile(projectDir, taskId, filename, data) {
|
|
469
|
-
const safe = basename(filename);
|
|
470
|
-
ensureFilesDir(projectDir, taskId);
|
|
471
|
-
writeFileSync2(join3(getFilesDir(projectDir, taskId), safe), data);
|
|
472
|
-
const refs = migrateLegacyLinkedRefs(projectDir, taskId);
|
|
473
|
-
if (!refs.find((f) => f.name === safe && !f.linkedPath)) {
|
|
474
|
-
refs.push({ name: safe, addedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
475
|
-
setTaskFileRefs(projectDir, taskId, refs);
|
|
476
|
-
}
|
|
477
|
-
return {
|
|
478
|
-
name: safe,
|
|
479
|
-
size: data.length,
|
|
480
|
-
url: `/api/tasks/${taskId}/files/${encodeURIComponent(safe)}`
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
function linkFile(projectDir, taskId, absolutePath) {
|
|
484
|
-
if (!isAbsolute(absolutePath)) return null;
|
|
485
|
-
if (!existsSync3(absolutePath)) return null;
|
|
486
|
-
const stat = statSync(absolutePath);
|
|
487
|
-
if (!stat.isFile()) return null;
|
|
488
|
-
const name = basename(absolutePath);
|
|
489
|
-
const refs = migrateLegacyLinkedRefs(projectDir, taskId);
|
|
490
|
-
if (!refs.find((f) => f.linkedPath === absolutePath)) {
|
|
491
|
-
refs.push({
|
|
492
|
-
name,
|
|
493
|
-
linkedPath: absolutePath,
|
|
494
|
-
addedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
495
|
-
});
|
|
496
|
-
setTaskFileRefs(projectDir, taskId, refs);
|
|
497
|
-
}
|
|
498
|
-
return {
|
|
499
|
-
name,
|
|
500
|
-
size: stat.size,
|
|
501
|
-
url: `/api/tasks/${taskId}/files/${encodeURIComponent(name)}`,
|
|
502
|
-
linkedPath: absolutePath
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
function deleteFile(projectDir, taskId, filename) {
|
|
506
|
-
const safe = basename(filename);
|
|
507
|
-
const refs = migrateLegacyLinkedRefs(projectDir, taskId);
|
|
508
|
-
const idx = refs.findIndex((f) => f.name === safe);
|
|
509
|
-
if (idx !== -1) {
|
|
510
|
-
const [removed] = refs.splice(idx, 1);
|
|
511
|
-
setTaskFileRefs(projectDir, taskId, refs);
|
|
512
|
-
if (removed && !removed.linkedPath) {
|
|
513
|
-
const uploadedPath = join3(getFilesDir(projectDir, taskId), safe);
|
|
514
|
-
if (existsSync3(uploadedPath)) unlinkSync2(uploadedPath);
|
|
515
|
-
}
|
|
516
|
-
return true;
|
|
517
|
-
}
|
|
518
|
-
const filePath = join3(getFilesDir(projectDir, taskId), safe);
|
|
519
|
-
if (!existsSync3(filePath)) return false;
|
|
520
|
-
unlinkSync2(filePath);
|
|
521
|
-
return true;
|
|
522
|
-
}
|
|
523
|
-
function getFilePath(projectDir, taskId, filename) {
|
|
524
|
-
const safe = basename(filename);
|
|
525
|
-
const linkedRef = migrateLegacyLinkedRefs(projectDir, taskId).find((f) => f.name === safe && f.linkedPath);
|
|
526
|
-
if (linkedRef?.linkedPath && existsSync3(linkedRef.linkedPath)) return linkedRef.linkedPath;
|
|
527
|
-
const filePath = join3(getFilesDir(projectDir, taskId), safe);
|
|
528
|
-
return existsSync3(filePath) ? filePath : null;
|
|
529
|
-
}
|
|
530
|
-
function getFileCount(projectDir, taskId) {
|
|
531
|
-
return listFiles(projectDir, taskId).length;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
export {
|
|
535
|
-
PROTO_DIR,
|
|
536
|
-
AGENTS_DIR,
|
|
537
|
-
SCREENSHOTS_DIR,
|
|
538
|
-
CONFIG_FILE,
|
|
539
|
-
generateTaskId,
|
|
540
|
-
ensureTaskDirs,
|
|
541
|
-
getTaskFilePath,
|
|
542
|
-
findTaskFilePath,
|
|
543
|
-
createTask,
|
|
544
|
-
readTaskFile,
|
|
545
|
-
listTasks,
|
|
546
|
-
listTasksWithPaths,
|
|
547
|
-
updateTask,
|
|
548
|
-
deleteTask,
|
|
549
|
-
formatTaskForAgent,
|
|
550
|
-
migrateTasksFromMd,
|
|
551
|
-
getFilesDir,
|
|
552
|
-
ensureFilesDir,
|
|
553
|
-
listFiles,
|
|
554
|
-
saveFile,
|
|
555
|
-
linkFile,
|
|
556
|
-
deleteFile,
|
|
557
|
-
getFilePath,
|
|
558
|
-
getFileCount
|
|
559
|
-
};
|
|
560
|
-
//# sourceMappingURL=chunk-PK737AKV.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{readdirSync as M,writeFileSync as J,readFileSync as K,unlinkSync as b,statSync as F,mkdirSync as q,existsSync as m}from"fs";import{join as f,basename as v}from"path";var g=".vibeflow",$="tasks",S="tasks/files",R="tasks/screenshots",Z="config.json";import{existsSync as c,readFileSync as O,writeFileSync as E,mkdirSync as p,readdirSync as h,unlinkSync as D,renameSync as A}from"fs";import{join as u,extname as I}from"path";import{randomBytes as z}from"crypto";var V=["backlog","todo","in-progress","review","done"];function W(){return z(15).toString("hex")}function k(e){return u(e,g,$)}function j(e){let s=u(e,g),n=u(s,"files"),i=u(s,S),o=u(s,"screenshots"),t=u(s,R);if(c(n)){p(i,{recursive:!0});for(let r of h(n)){let a=u(n,r),l=u(i,r);if(!c(l))try{A(a,l)}catch{}}}if(c(o)){p(t,{recursive:!0});for(let r of h(o)){let a=u(o,r),l=u(t,r);if(!c(l))try{A(a,l)}catch{}}}}function re(e){j(e),p(k(e),{recursive:!0}),p(u(e,g,R),{recursive:!0});let s=u(e,".opencode"),n=u(s,"opencode.json");c(n)||(p(s,{recursive:!0}),E(n,JSON.stringify({$schema:"https://opencode.ai/config.json",plugin:["opencode-snip@latest"]},null,2),"utf-8"))}function w(e){return e.slice(0,10)}function U(e,s,n){let i=k(e);return n?u(i,w(n),`${s}.json`):u(i,`${s}.json`)}function T(e,s){let n=k(e);if(!c(n))return null;for(let i of h(n,{withFileTypes:!0}))if(i.isDirectory()){let o=u(n,i.name,`${s}.json`);if(c(o))return o}else if(i.name===`${s}.json`)return u(n,i.name);return null}function H(e){let s=(()=>{if(typeof e.type!="string")return;let n=e.type.trim();if(!(!n||n==="[object Object]"))return n})();return{id:String(e.id??""),title:String(e.title??"Untitled"),description:String(e.description??""),status:V.includes(e.status)?e.status:"todo",url:e.url?String(e.url):void 0,selector:(()=>{let n=String(e.selector??"/");return e.file&&!e.cssSelector&&n.startsWith(String(e.file))?e.url?String(e.url):"/":n})(),cssSelector:e.cssSelector&&String(e.cssSelector)!==String(e.selector??"/")?String(e.cssSelector):void 0,file:e.file?String(e.file):void 0,line:e.line!=null?Number(e.line):void 0,col:e.col!=null?Number(e.col):void 0,component:e.component?String(e.component):void 0,type:s,priority:e.priority?String(e.priority):void 0,...e.reportBack===!0&&{reportBack:!0},agent:e.agent?String(e.agent):void 0,model:e.model?String(e.model):void 0,author:e.author?String(e.author):void 0,commits:Array.isArray(e.commits)?e.commits.map(n=>({sha:String(n.sha??""),message:String(n.message??""),timestamp:String(n.timestamp??new Date().toISOString())})):void 0,created:String(e.created??new Date().toISOString()),updated:e.updated?String(e.updated):void 0,comments:Array.isArray(e.comments)?e.comments.map(n=>({...n,text:n.text??n.content??""})):[],files:Array.isArray(e.files)?e.files.map(n=>typeof n=="string"?{name:n,addedAt:new Date().toISOString()}:{name:String(n.name??""),addedAt:String(n.addedAt??new Date().toISOString()),linkedPath:n.linkedPath?String(n.linkedPath):void 0,mimeType:n.mimeType?String(n.mimeType):void 0}).filter(n=>n.name):[],screenshot:e.screenshot?String(e.screenshot):void 0,annotatedElementText:e.annotatedElementText?String(e.annotatedElementText):void 0,tags:Array.isArray(e.tags)?e.tags.filter(n=>typeof n=="string"&&n.length>0):void 0}}function L(e,s){let n=u(k(e),w(s.created));p(n,{recursive:!0});let i=u(n,`${s.id}.json`),o=i+".tmp";E(o,JSON.stringify(s,null,2),"utf-8"),A(o,i)}function oe(e,s){let n=(()=>{let o=(s.priority??"").trim().toLowerCase();return o==="critical"?"Critical":o==="high"?"High":o==="low"?"Low":"Medium"})(),i={...s,priority:n,id:W(),created:new Date().toISOString(),comments:[],files:[]};return L(e,i),i}function y(e){try{let s=O(e,"utf-8");if(e.endsWith(".json")){let n=JSON.parse(s);return!n||typeof n!="object"||!("id"in n)?null:H(n)}return null}catch{return null}}function N(e){let s=k(e);if(!c(s))return[];let n=[];for(let i of h(s,{withFileTypes:!0}))if(i.isDirectory()){let o=u(s,i.name);for(let t of h(o))if(I(t)===".json"){let r=u(o,t),a=y(r);a&&n.push({task:a,filePath:r})}}else if(I(i.name)===".json"){let o=u(s,i.name),t=y(o);t&&n.push({task:t,filePath:o})}return n}function ae(e){return N(e).map(({task:s})=>s)}function ue(e){return N(e).map(({task:s,filePath:n})=>({...s,filePath:n}))}function B(e,s,n){let i=T(e,s),o=i?y(i):null;if(!o)return null;let t={...o,...n,updated:new Date().toISOString()};if(L(e,t),i&&i!==U(e,s,t.created))try{D(i)}catch{}return t}function le(e,s){let n=T(e,s);return n?(D(n),!0):!1}function ce(e,s,n){return{id:e.id,status:e.status,title:e.title,description:e.description,...e.url&&{url:e.url},selector:e.selector,...e.file&&{file:e.file},...e.line!=null&&{line:e.line},...e.col!=null&&{col:e.col},...e.component&&{component:e.component},...e.type&&{type:e.type},...e.priority&&{priority:e.priority},...s&&s.length>0&&{structuredComments:s},...n&&n.length>0&&{linkedFiles:n},...e.reportBack&&{reportBack:!0},created:e.created}}function me(e,s,n,i,o){let t=[];if(t.push(`[${e.status}] ${e.title}`),t.push(` id: ${e.id}`),t.push(` file: ${s}`),e.file&&t.push(` source: ${e.file}${e.line!=null?`:${e.line}`:""}${e.col!=null?`:${e.col}`:""}`),e.component&&t.push(` component: ${e.component}`),t.push(` selector: ${e.selector??"/"}`),e.cssSelector&&t.push(` css: ${e.cssSelector}`),e.url&&t.push(` url: ${e.url}`),e.commits&&e.commits.length>0)if(e.commits.length===1)t.push(` commit: ${e.commits[0].sha}`);else{t.push(` commits (${e.commits.length}):`);for(let r of e.commits)t.push(` ${r.sha.slice(0,8)} ${r.timestamp} ${r.message.slice(0,60)}`)}if(t.push(` created: ${e.created}`),e.type&&t.push(` type: ${e.type}`),e.priority&&t.push(` priority: ${e.priority}`),e.author&&t.push(` author: ${e.author}`),e.description){t.push(" description:");for(let r of e.description.split(`
|
|
3
|
-
`))t.push(` ${r}`)}if(e.annotatedElementText&&t.push(` element text: ${e.annotatedElementText}`),n.length>0){t.push(` comments (${n.length}):`);for(let r of n){let a=r.updatedAt?` (edited ${r.updatedAt})`:"";t.push(` [${r.author??"user"}] ${r.createdAt}${a}`);for(let l of r.text.split(`
|
|
4
|
-
`))t.push(` ${l}`)}}if(i.length>0){t.push(` linked files (${i.length}):`);for(let r of i){t.push(` - ${r.name} ${r.url}`);let a=r.linkedPath??u(o,".vibeflow","files",e.id,r.name);if(/\.(md|txt)$/i.test(r.name)&&r.size<1e5&&c(a))try{let l=O(a,"utf-8");t.push(" \u250C\u2500\u2500 content \u2500\u2500");for(let _ of l.split(`
|
|
5
|
-
`))t.push(` \u2502 ${_}`);t.push(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")}catch{}}}return t.join(`
|
|
6
|
-
`)}function fe(e){let{autoCommit:s,autoPush:n,autoComment:i,createBranch:o}=e,t=[];if(t.push("Agent instructions (concise):"),t.push(" Discover: vibeflow tasks --status todo | vibeflow tasks --type Research | vibeflow tasks --user <email> | vibeflow tasks --tag <tag>"),t.push(" Details: vibeflow tasks --get <id> (full task info with comments and files)"),t.push(' Create: vibeflow tasks --add --title "..." --description "..."'),t.push(""),t.push(" Workflow:"),t.push(" \u26A0 IMMEDIATELY set in-progress BEFORE any implementation work:"),t.push(" 1. vibeflow tasks --edit <id> --set-status in-progress \u2190 DO THIS FIRST"),t.push(" 2. <implement the change>"),s){t.push(" 3. git add <files> (stage your changes first)");let r=["--set-status review"];s&&r.push('--commit-message "<one-line summary>"'),i&&r.push('--comment "<report>"'),t.push(` 4. vibeflow tasks --edit <id> ${r.join(" ")}`),t.push(" CLI will commit staged changes and link the commit SHA automatically.")}else{t.push(' 3. git add <files> && vibeflow tasks --commit --task <id> --message "<one-line summary>"');let r=["--set-status review"];i&&r.push('--comment "<report>"'),t.push(` 4. vibeflow tasks --edit <id> ${r.join(" ")}`)}return i&&(t.push(""),t.push(" Comment format (--comment):"),t.push(" \xB7 Plain text for concise one-liners."),t.push(" \xB7 Markdown for multi-section reports. Use **bold**, bullet lists, code fences."),t.push(" \xB7 Must cover: what changed, why, key decisions, anything future agents should know."),t.push(" \xB7 For long reports, attach a .md file and reference it in the comment.")),t.push(""),s&&t.push(" [setting] Auto-commit ON: provide --commit-message when setting status to review; CLI commits."),n&&t.push(" [setting] Auto-push ON: CLI pushes after the commit automatically."),i&&t.push(" [setting] Auto-comment ON: --comment is required when setting status to review."),o&&(t.push(" [setting] Create branch ON: after ALL tasks in this session are done, create and push a descriptive branch:"),t.push(" git checkout -b <short-name> (e.g. fix/annotation-errors, feat/eye-toggle, chore/cleanup-extension)"),t.push(" git push -u origin HEAD"),t.push(" Branch name rules: lowercase, kebab-case, 2-5 words, prefix fix/feat/chore/docs."),t.push(" Describe the WORK done (not dates). Bad: agent/2026-04-16. Good: fix/bug-errors-visibility.")),e.hasResearchTasks&&(t.push(" Research tasks: NEVER generate code \u2014 research only."),t.push(" Attach a .md report before marking Research tasks as review."),t.push(" CLI ENFORCES: cannot mark Research as review without an attached .md report."),t.push(" Use --report-file <path> to upload your .md report when marking as review:"),t.push(' vibeflow tasks --edit <id> --set-status review --report-file ./report.md --comment "..."'),t.push(" The file is uploaded to the task and deleted from the local filesystem automatically.")),e.hasBugTasks&&(t.push(" Bug tasks: Include error logs / stack traces in the commit comment."),t.push(" Describe: the symptom, the console error, what triggered it, and how it was fixed.")),t.push(" CRITICAL: NEVER edit .vibeflow/ task files directly."),t.push(" All task operations (status, comments, commits) must go through CLI commands."),t.push(" CRITICAL: Set in-progress BEFORE reading/planning. Other agents may pick the same task."),t.push(" The in-progress transition signals ownership. Skip it and another agent may duplicate your work."),t.push(" Sequence: discover tasks \u2192 pick one \u2192 set in-progress \u2192 THEN read details and implement."),t.push(' CRITICAL: NEVER set a task status to "done".'),t.push(' When your implementation is complete, set the status to "review" \u2014 not "done".'),t.push(" Only humans can mark tasks as done after reviewing the work."),t.push(" The CLI will warn you and still allow the change \u2014 but agents must not use it."),t.push(""),t.join(`
|
|
7
|
-
`)}var P=".linked.json";function d(e,s){return f(e,g,S,s)}function G(e,s){q(d(e,s),{recursive:!0})}function Y(e,s){let n=f(d(e,s),P);if(!m(n))return[];try{return JSON.parse(K(n,"utf-8"))}catch{return[]}}function Q(e,s){let n=T(e,s),i=n?y(n):null;return!i?.files||i.files.length===0?[]:i.files}function C(e,s,n){B(e,s,{files:n})}function x(e,s){let n=Q(e,s),i=f(d(e,s),P);if(!m(i))return n;let o=Y(e,s);if(o.length===0){try{b(i)}catch{}return n}let t=n.slice(),r=!1;for(let a of o)t.find(l=>l.linkedPath===a.path||l.name===a.name&&l.linkedPath)||(t.push({name:a.name,linkedPath:a.path,addedAt:new Date().toISOString()}),r=!0);r&&C(e,s,t);try{b(i)}catch{}return t}function X(e,s){let n=d(e,s),i=x(e,s),o=new Map;for(let t of i){if(t.linkedPath&&m(t.linkedPath)){let a=F(t.linkedPath);o.set(t.name,{name:t.name,size:a.size,url:`/api/tasks/${s}/files/${encodeURIComponent(t.name)}`,linkedPath:t.linkedPath,createdAt:a.mtime.toISOString()});continue}let r=f(n,t.name);if(m(r)){let a=F(r);o.set(t.name,{name:t.name,size:a.size,url:`/api/tasks/${s}/files/${encodeURIComponent(t.name)}`,createdAt:a.mtime.toISOString()})}}if(m(n))for(let t of M(n,{withFileTypes:!0})){if(!t.isFile()||t.name===P||o.has(t.name))continue;let r=f(n,t.name),a=F(r);o.set(t.name,{name:t.name,size:a.size,url:`/api/tasks/${s}/files/${encodeURIComponent(t.name)}`,createdAt:a.mtime.toISOString()})}return Array.from(o.values())}function Se(e,s,n,i){let o=v(n);G(e,s),J(f(d(e,s),o),i);let t=x(e,s);return t.find(r=>r.name===o&&!r.linkedPath)||(t.push({name:o,addedAt:new Date().toISOString()}),C(e,s,t)),{name:o,size:i.length,url:`/api/tasks/${s}/files/${encodeURIComponent(o)}`}}function Te(e,s,n){let i=v(n),o=x(e,s),t=o.findIndex(a=>a.name===i);if(t!==-1){let[a]=o.splice(t,1);if(C(e,s,o),a&&!a.linkedPath){let l=f(d(e,s),i);m(l)&&b(l)}return!0}let r=f(d(e,s),i);return m(r)?(b(r),!0):!1}function be(e,s,n){let i=v(n),o=x(e,s).find(r=>r.name===i&&r.linkedPath);if(o?.linkedPath&&m(o.linkedPath))return o.linkedPath;let t=f(d(e,s),i);return m(t)?t:null}function xe(e,s){return X(e,s).length}export{g as a,$ as b,R as c,Z as d,W as e,re as f,U as g,T as h,oe as i,y as j,ae as k,ue as l,B as m,le as n,ce as o,me as p,fe as q,d as r,G as s,X as t,Se as u,Te as v,be as w,xe as x};
|