@goodtek/vibeops 0.7.22 → 1.1.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.
Files changed (144) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +51 -380
  3. package/dist/bootstrap/installer.js +42 -20
  4. package/dist/bootstrap/manifest.js +23 -3
  5. package/dist/cli.js +69 -154
  6. package/dist/commands/init.js +279 -114
  7. package/dist/commands/llm.js +177 -0
  8. package/dist/commands/status.js +181 -8
  9. package/dist/commands/task-add.js +89 -162
  10. package/dist/commands/task-done.js +112 -73
  11. package/dist/lib/config.js +77 -113
  12. package/dist/lib/env.js +32 -0
  13. package/dist/lib/git-config.js +21 -0
  14. package/dist/lib/git-host.js +12 -0
  15. package/dist/lib/git-policy.js +67 -0
  16. package/dist/lib/git-remote.js +108 -0
  17. package/dist/lib/git.js +44 -1
  18. package/dist/lib/init-clients.js +55 -0
  19. package/dist/lib/llm-complete.js +18 -19
  20. package/dist/lib/llm-connect.js +150 -0
  21. package/dist/lib/llm-preference.js +102 -0
  22. package/dist/lib/llm-status.js +19 -0
  23. package/dist/lib/paths.js +7 -3
  24. package/dist/lib/plan-llm-openai.js +0 -63
  25. package/dist/lib/pr-create.js +66 -0
  26. package/dist/lib/resolve-task.js +34 -0
  27. package/dist/lib/task-add-llm.js +53 -233
  28. package/dist/lib/task-context.js +68 -0
  29. package/dist/lib/task-done-llm.js +155 -0
  30. package/dist/lib/task-pr-llm.js +50 -0
  31. package/dist/lib/task-push-pr.js +131 -0
  32. package/dist/lib/task-scaffold.js +39 -43
  33. package/dist/lib/task-start.js +100 -0
  34. package/dist/lib/task-summary.js +12 -239
  35. package/dist/lib/task.js +30 -24
  36. package/dist/types/config.js +0 -16
  37. package/package.json +14 -14
  38. package/templates/.cursor/rules/02-git-safety.mdc +12 -0
  39. package/templates/AGENTS.md +27 -87
  40. package/templates/clients/claude/CLAUDE.md +28 -0
  41. package/templates/clients/cursor/.cursor/rules/01-task-source-of-truth.mdc +12 -0
  42. package/templates/clients/cursor/.cursor/rules/02-git-safety.mdc +11 -0
  43. package/templates/clients/cursor/.cursor/rules/03-docs-on-done.mdc +13 -0
  44. package/templates/core/AGENTS.md +44 -0
  45. package/templates/core/docs/logs/README.md +7 -0
  46. package/templates/core/docs/project/03-architecture.md +15 -0
  47. package/templates/core/docs/project/05-current-state.md +15 -0
  48. package/templates/core/docs/project/06-decisions.md +9 -0
  49. package/templates/core/docs/tasks/TASK-000-template.md +37 -0
  50. package/templates/skills-shared/implement-task/SKILL.md +22 -0
  51. package/templates/skills-shared/plan-task/SKILL.md +19 -0
  52. package/dist/agent/loader.js +0 -71
  53. package/dist/agent/prompt.js +0 -66
  54. package/dist/commands/agent-list.js +0 -32
  55. package/dist/commands/agent-prompt.js +0 -59
  56. package/dist/commands/agent-show.js +0 -26
  57. package/dist/commands/done.js +0 -160
  58. package/dist/commands/github-init.js +0 -554
  59. package/dist/commands/github-status.js +0 -164
  60. package/dist/commands/next.js +0 -283
  61. package/dist/commands/notion-init.js +0 -764
  62. package/dist/commands/notion-sync.js +0 -405
  63. package/dist/commands/notion-test.js +0 -595
  64. package/dist/commands/plan.js +0 -146
  65. package/dist/commands/rollback.js +0 -126
  66. package/dist/commands/start.js +0 -129
  67. package/dist/commands/task-check.js +0 -155
  68. package/dist/commands/task-generate.js +0 -206
  69. package/dist/commands/task-pull.js +0 -277
  70. package/dist/commands/task-rollback.js +0 -174
  71. package/dist/commands/task-start.js +0 -102
  72. package/dist/commands/task-status.js +0 -122
  73. package/dist/lib/brief.js +0 -356
  74. package/dist/lib/cursor-task-prompt.js +0 -60
  75. package/dist/lib/done-follow-up.js +0 -308
  76. package/dist/lib/github-cli.js +0 -247
  77. package/dist/lib/guide-state.js +0 -69
  78. package/dist/lib/mvp-artifacts.js +0 -204
  79. package/dist/lib/mvp-constants.js +0 -15
  80. package/dist/lib/mvp-diff-summary.js +0 -43
  81. package/dist/lib/mvp-done-summary.js +0 -335
  82. package/dist/lib/notion-client.js +0 -459
  83. package/dist/lib/notion-discovery.js +0 -671
  84. package/dist/lib/notion-env.js +0 -140
  85. package/dist/lib/notion-mappers.js +0 -148
  86. package/dist/lib/notion-schema.js +0 -272
  87. package/dist/lib/notion-sync.js +0 -337
  88. package/dist/lib/notion-target.js +0 -247
  89. package/dist/lib/package-json.js +0 -133
  90. package/dist/lib/plan-apply-planner.js +0 -131
  91. package/dist/lib/plan-codex-pkce.js +0 -234
  92. package/dist/lib/plan-llm-models.js +0 -237
  93. package/dist/lib/plan-llm-normalize.js +0 -146
  94. package/dist/lib/plan-llm-session.js +0 -682
  95. package/dist/lib/plan-post-apply-setup.js +0 -116
  96. package/dist/lib/project-docs.js +0 -95
  97. package/dist/lib/prompt-builder.js +0 -135
  98. package/dist/lib/resolve-command-task.js +0 -40
  99. package/dist/lib/task-add-build-prompt.js +0 -39
  100. package/dist/lib/task-add-cursor.js +0 -81
  101. package/dist/lib/task-generator.js +0 -183
  102. package/dist/lib/task-merge.js +0 -220
  103. package/dist/lib/task-prompt.js +0 -23
  104. package/dist/lib/task-pull.js +0 -354
  105. package/dist/lib/task-status-brief.js +0 -132
  106. package/dist/lib/workflow-guide.js +0 -485
  107. package/dist/status/collector.js +0 -103
  108. package/dist/status/format.js +0 -181
  109. package/dist/types/brief.js +0 -126
  110. package/templates/.cursor/rules/00-project-governance.mdc +0 -28
  111. package/templates/.cursor/rules/01-agent-orchestration.mdc +0 -48
  112. package/templates/.cursor/rules/02-task-workflow.mdc +0 -38
  113. package/templates/.cursor/rules/03-git-safety.mdc +0 -30
  114. package/templates/.cursor/rules/04-docs-update.mdc +0 -22
  115. package/templates/.vibeops/agents/architect.md +0 -47
  116. package/templates/.vibeops/agents/builder.md +0 -38
  117. package/templates/.vibeops/agents/docs.md +0 -54
  118. package/templates/.vibeops/agents/orchestrator.md +0 -40
  119. package/templates/.vibeops/agents/planner.md +0 -60
  120. package/templates/.vibeops/agents/recovery.md +0 -49
  121. package/templates/.vibeops/agents/reviewer.md +0 -47
  122. package/templates/.vibeops/agents/tester.md +0 -43
  123. package/templates/.vibeops/prompts/create-plan.md +0 -33
  124. package/templates/.vibeops/prompts/generate-tasks.md +0 -41
  125. package/templates/.vibeops/prompts/implement-task.md +0 -39
  126. package/templates/.vibeops/prompts/review-task.md +0 -34
  127. package/templates/.vibeops/prompts/rollback.md +0 -32
  128. package/templates/.vibeops/prompts/start-project.md +0 -39
  129. package/templates/.vibeops/workflows/notion-sync.md +0 -53
  130. package/templates/.vibeops/workflows/project-start.md +0 -73
  131. package/templates/.vibeops/workflows/rollback.md +0 -45
  132. package/templates/.vibeops/workflows/task-lifecycle.md +0 -71
  133. package/templates/docs/logs/README.md +0 -38
  134. package/templates/docs/project/00-overview.md +0 -27
  135. package/templates/docs/project/01-requirements.md +0 -30
  136. package/templates/docs/project/02-mvp-scope.md +0 -36
  137. package/templates/docs/project/03-architecture.md +0 -34
  138. package/templates/docs/project/04-tech-stack.md +0 -29
  139. package/templates/docs/project/05-current-state.md +0 -35
  140. package/templates/docs/project/06-decisions.md +0 -20
  141. package/templates/docs/project/07-backlog.md +0 -23
  142. package/templates/docs/project/08-env.md +0 -29
  143. package/templates/docs/project/09-deployment.md +0 -28
  144. package/templates/docs/tasks/TASK-000-template.md +0 -72
@@ -1,354 +0,0 @@
1
- /**
2
- * Planning + execution helpers for `vibeops task pull`.
3
- *
4
- * Notion is queried for TASK rows whose Status matches `--status` (default
5
- * "Planned"). For each row that does NOT yet have a local TASK file we plan
6
- * a new `docs/tasks/TASK-NNN-slug.md` skeleton.
7
- *
8
- * Rules:
9
- * - Never overwrite an existing local file.
10
- * - Never write any TASK body section beyond the Notion-sourced metadata.
11
- * - Always include a `## Notion Page` section so `notion sync` can later
12
- * update the same row in place.
13
- *
14
- * Mutation surface:
15
- * - `executePullEntry` writes the local file and (if Docs Path on Notion
16
- * was empty) optionally updates the Notion page's Docs Path. Callers in
17
- * dry-run mode MUST skip this.
18
- */
19
- import { readdir } from "node:fs/promises";
20
- import { basename, join, posix } from "node:path";
21
- import { pathExists, writeText } from "./filesystem.js";
22
- import { projectPaths } from "./paths.js";
23
- import { formatTaskId, highestTaskNumber, } from "./task.js";
24
- import { slugify } from "./task-generator.js";
25
- import { readRichText, readSelect, readStatus, readTitle, richTextEqualsFilter, richTextProperty, statusEqualsFilter, andFilter, } from "./notion-mappers.js";
26
- import { renderPulledTaskMarkdown, } from "./task-summary.js";
27
- export function rowFromNotionPage(page) {
28
- const p = page.properties;
29
- return {
30
- pageId: page.id,
31
- taskId: readRichText(p["Task ID"]),
32
- name: readTitle(p.Name),
33
- status: readStatus(p.Status),
34
- mvpPhase: readSelect(p["MVP Phase"]),
35
- priority: readSelect(p.Priority),
36
- summary: readRichText(p.Summary),
37
- docsPath: readRichText(p["Docs Path"]),
38
- };
39
- }
40
- const DEFAULT_STATUS_NAMES = ["Planned"];
41
- const DEFAULT_LIMIT = 20;
42
- const MAX_LIMIT = 100;
43
- function buildPullFilter(projectId, statusNames) {
44
- const statusFilters = statusNames.map((n) => statusEqualsFilter("Status", n));
45
- const statusFilter = statusFilters.length === 1
46
- ? statusFilters[0]
47
- : { or: statusFilters };
48
- return andFilter([
49
- richTextEqualsFilter("Project ID", projectId),
50
- statusFilter,
51
- ]);
52
- }
53
- /**
54
- * Notion `Docs Path` is **trusted only when its basename matches the TASK
55
- * ID**. A row whose Task ID is `TASK-099` but whose Docs Path points at
56
- * `docs/tasks/TASK-012-package-polish-readme.md` is a mismatch — surfacing
57
- * it as `local-file-exists` silently shadows the real TASK-099 candidate.
58
- *
59
- * Acceptable basenames (case sensitive — Notion is case sensitive here):
60
- * - `TASK-099.md`
61
- * - `TASK-099-anything.md` (the standard `TASK-NNN-slug.md` form)
62
- *
63
- * Anything else is a mismatch.
64
- */
65
- export function docsPathMatchesTaskId(docsRelativePath, taskId) {
66
- if (docsRelativePath.length === 0 || taskId.length === 0)
67
- return false;
68
- const base = basename(docsRelativePath);
69
- return base === `${taskId}.md` || base.startsWith(`${taskId}-`);
70
- }
71
- /** Scan `docs/tasks` for any file whose basename starts with `TASK-NNN`. */
72
- async function findLocalTaskFileForId(docsTasksDir, taskId) {
73
- let entries;
74
- try {
75
- entries = await readdir(docsTasksDir);
76
- }
77
- catch {
78
- return null;
79
- }
80
- for (const name of entries) {
81
- if (name === `${taskId}.md` || name.startsWith(`${taskId}-`)) {
82
- return join(docsTasksDir, name);
83
- }
84
- }
85
- return null;
86
- }
87
- export async function planPull(inputs) {
88
- const statusNames = inputs.statusNames ?? DEFAULT_STATUS_NAMES;
89
- const limit = Math.max(1, Math.min(inputs.limit ?? DEFAULT_LIMIT, MAX_LIMIT));
90
- const res = await inputs.client.queryDataSource(inputs.tasksDataSourceId, {
91
- filter: buildPullFilter(inputs.projectId, statusNames),
92
- pageSize: limit,
93
- });
94
- const paths = projectPaths(inputs.cwd);
95
- const startCounter = await highestTaskNumber(paths.docsTasks);
96
- let nextNumber = startCounter + 1;
97
- const entries = [];
98
- const skipped = [];
99
- const trace = [];
100
- // First pass: detect duplicate Task IDs across the Notion query result so
101
- // a second row with the same id cannot quietly create a second entry. We
102
- // keep the first row and skip subsequent ones with `duplicate-task-id`.
103
- const seenTaskIds = new Set();
104
- const duplicatePageIds = new Set();
105
- for (const page of res.results) {
106
- const id = rowFromNotionPage(page).taskId.trim();
107
- if (id.length === 0)
108
- continue;
109
- if (seenTaskIds.has(id)) {
110
- duplicatePageIds.add(page.id);
111
- }
112
- else {
113
- seenTaskIds.add(id);
114
- }
115
- }
116
- for (const page of res.results) {
117
- const row = rowFromNotionPage(page);
118
- const notionDocsPath = row.docsPath.trim();
119
- // (A) Task ID required — guard against blank ids before we touch local fs.
120
- const taskIdRaw = row.taskId.trim();
121
- if (taskIdRaw.length === 0 && notionDocsPath.length === 0) {
122
- // No Task ID and no Docs Path → allocate a fresh one, treated as a
123
- // legitimate "new" candidate (existing behaviour). Trace it so
124
- // `--verbose` makes the allocation visible.
125
- const taskId = formatTaskId(nextNumber);
126
- nextNumber++;
127
- const slug = slugify(row.name.length > 0 ? row.name : taskId, taskId.toLowerCase());
128
- const docsRelativePath = posix.join("docs/tasks", `${taskId}-${slug}.md`);
129
- const absPath = join(paths.docsTasks, `${taskId}-${slug}.md`);
130
- // Even an allocated id may already be present on disk (race / manual
131
- // creation). Re-check.
132
- if (await pathExists(absPath)) {
133
- skipped.push({
134
- pageId: page.id,
135
- taskId,
136
- reason: "local-file-exists",
137
- docsRelativePath,
138
- detail: `local resolved path: ${docsRelativePath}`,
139
- });
140
- trace.push({
141
- taskId,
142
- pageId: page.id,
143
- notionDocsPath,
144
- localResolvedPath: docsRelativePath,
145
- decision: "skip-local-file-exists",
146
- reason: "Task ID was empty, allocated next id already on disk",
147
- });
148
- continue;
149
- }
150
- entries.push({
151
- pageId: page.id,
152
- taskId,
153
- title: row.name.length > 0 ? row.name : taskId,
154
- status: row.status,
155
- mvpPhase: row.mvpPhase,
156
- summary: row.summary,
157
- docsRelativePath,
158
- absPath,
159
- notionNeedsDocsPath: true,
160
- detail: "allocated Task ID (Notion row had none)",
161
- });
162
- trace.push({
163
- taskId,
164
- pageId: page.id,
165
- notionDocsPath: "",
166
- localResolvedPath: docsRelativePath,
167
- decision: "new-file",
168
- reason: "Task ID empty → allocated; no local file with that id",
169
- });
170
- continue;
171
- }
172
- if (taskIdRaw.length === 0) {
173
- // Has a Docs Path but no Task ID — refuse to act. Renaming pages from
174
- // empty ids is risky and not in TASK-011 scope.
175
- skipped.push({
176
- pageId: page.id,
177
- taskId: "(none)",
178
- reason: "no-task-id",
179
- docsRelativePath: notionDocsPath,
180
- detail: `notion docs path: ${notionDocsPath}`,
181
- });
182
- trace.push({
183
- taskId: "(none)",
184
- pageId: page.id,
185
- notionDocsPath,
186
- localResolvedPath: notionDocsPath,
187
- decision: "skip-no-task-id",
188
- reason: "Notion row has Docs Path but no Task ID",
189
- });
190
- continue;
191
- }
192
- const taskId = taskIdRaw;
193
- // (A.2) duplicate Task ID across the considered rows.
194
- if (duplicatePageIds.has(page.id)) {
195
- skipped.push({
196
- pageId: page.id,
197
- taskId,
198
- reason: "duplicate-task-id",
199
- docsRelativePath: notionDocsPath,
200
- detail: `another Notion row already used this Task ID in the same query`,
201
- });
202
- trace.push({
203
- taskId,
204
- pageId: page.id,
205
- notionDocsPath,
206
- localResolvedPath: "",
207
- decision: "skip-duplicate-task-id",
208
- reason: "duplicate Task ID across considered rows — kept first row only",
209
- });
210
- continue;
211
- }
212
- // (B) Notion Docs Path exists but does NOT match this Task ID. Refuse
213
- // to create / overwrite — surface a `docs-path-mismatch` so the user
214
- // can fix Notion. We deliberately do NOT auto-rename — auto-fixing
215
- // Notion's Docs Path on a mismatch is reserved for a future
216
- // `--fix-docs-path` opt-in.
217
- if (notionDocsPath.length > 0 &&
218
- !docsPathMatchesTaskId(notionDocsPath, taskId)) {
219
- skipped.push({
220
- pageId: page.id,
221
- taskId,
222
- reason: "docs-path-mismatch",
223
- docsRelativePath: notionDocsPath,
224
- detail: `notion docs path: ${notionDocsPath}\n` +
225
- `expected basename prefix: ${taskId}- or ${taskId}.md\n` +
226
- `action: fix Notion 'Docs Path' for this row (auto-fix not enabled).`,
227
- });
228
- trace.push({
229
- taskId,
230
- pageId: page.id,
231
- notionDocsPath,
232
- localResolvedPath: notionDocsPath,
233
- decision: "skip-docs-path-mismatch",
234
- reason: `Notion Docs Path basename does not match ${taskId}- prefix`,
235
- });
236
- continue;
237
- }
238
- // (C) / (D) / (F) — resolve where the local file would live and check
239
- // for existing files. If Notion gave us a matching Docs Path, honour
240
- // it. Otherwise scan `docs/tasks` for any `TASK-NNN-*.md` already on
241
- // disk; if found, treat the row as `local-file-exists`. If not, plan a
242
- // new `TASK-NNN-slug.md`.
243
- const slug = slugify(row.name.length > 0 ? row.name : taskId, taskId.toLowerCase());
244
- let docsRelativePath;
245
- let absPath;
246
- let notionNeedsDocsPath;
247
- let decisionDetail;
248
- if (notionDocsPath.length > 0) {
249
- docsRelativePath = notionDocsPath;
250
- absPath = join(inputs.cwd, notionDocsPath);
251
- notionNeedsDocsPath = false;
252
- decisionDetail = `notion docs path: ${notionDocsPath}`;
253
- }
254
- else {
255
- const existing = await findLocalTaskFileForId(paths.docsTasks, taskId);
256
- if (existing !== null) {
257
- const rel = posix.join("docs/tasks", basename(existing));
258
- skipped.push({
259
- pageId: page.id,
260
- taskId,
261
- reason: "local-file-exists",
262
- docsRelativePath: rel,
263
- detail: `local resolved path: ${rel}\n` +
264
- `notion docs path: (empty)`,
265
- });
266
- trace.push({
267
- taskId,
268
- pageId: page.id,
269
- notionDocsPath: "",
270
- localResolvedPath: rel,
271
- decision: "skip-local-file-exists",
272
- reason: "Notion Docs Path empty, but a local file matching the Task ID was found on disk",
273
- });
274
- continue;
275
- }
276
- docsRelativePath = posix.join("docs/tasks", `${taskId}-${slug}.md`);
277
- absPath = join(paths.docsTasks, `${taskId}-${slug}.md`);
278
- notionNeedsDocsPath = true;
279
- decisionDetail = `local resolved path: ${docsRelativePath}`;
280
- }
281
- if (await pathExists(absPath)) {
282
- skipped.push({
283
- pageId: page.id,
284
- taskId,
285
- reason: "local-file-exists",
286
- docsRelativePath,
287
- detail: decisionDetail,
288
- });
289
- trace.push({
290
- taskId,
291
- pageId: page.id,
292
- notionDocsPath,
293
- localResolvedPath: docsRelativePath,
294
- decision: "skip-local-file-exists",
295
- reason: notionDocsPath.length > 0
296
- ? "Notion Docs Path matched Task ID and file already exists on disk"
297
- : "local search found a file matching the Task ID",
298
- });
299
- continue;
300
- }
301
- entries.push({
302
- pageId: page.id,
303
- taskId,
304
- title: row.name.length > 0 ? row.name : taskId,
305
- status: row.status,
306
- mvpPhase: row.mvpPhase,
307
- summary: row.summary,
308
- docsRelativePath,
309
- absPath,
310
- notionNeedsDocsPath,
311
- detail: decisionDetail,
312
- });
313
- trace.push({
314
- taskId,
315
- pageId: page.id,
316
- notionDocsPath,
317
- localResolvedPath: docsRelativePath,
318
- decision: "new-file",
319
- reason: notionDocsPath.length > 0
320
- ? "Notion Docs Path matched Task ID — local file does not exist yet"
321
- : "Notion Docs Path empty — planning fresh local file under docs/tasks",
322
- });
323
- }
324
- return { entries, skipped, considered: res.results.length, trace };
325
- }
326
- export async function executePullEntry(client, entry) {
327
- const md = renderPulledTaskMarkdown({
328
- taskId: entry.taskId,
329
- title: entry.title,
330
- status: entry.status,
331
- mvpPhase: entry.mvpPhase,
332
- summary: entry.summary,
333
- pageId: entry.pageId,
334
- docsRelativePath: entry.docsRelativePath,
335
- });
336
- await writeText(entry.absPath, md);
337
- let notionUpdated = false;
338
- if (entry.notionNeedsDocsPath) {
339
- await client.updatePage({
340
- pageId: entry.pageId,
341
- properties: {
342
- "Docs Path": richTextProperty(entry.docsRelativePath),
343
- },
344
- });
345
- notionUpdated = true;
346
- }
347
- return {
348
- taskId: entry.taskId,
349
- pageId: entry.pageId,
350
- absPath: entry.absPath,
351
- docsRelativePath: entry.docsRelativePath,
352
- notionUpdated,
353
- };
354
- }
@@ -1,132 +0,0 @@
1
- import { join, relative } from "node:path";
2
- import { readConfig } from "./config.js";
3
- import { pathExists, readText } from "./filesystem.js";
4
- import { gitBranchExists, readGitInfo } from "./git.js";
5
- import { MVP_BUILD_PROMPT_REL } from "./mvp-constants.js";
6
- import { taskBuildPromptRel } from "./task-add-build-prompt.js";
7
- import { projectPaths } from "./paths.js";
8
- import { cursorImplementPromptRel } from "./cursor-task-prompt.js";
9
- import { summarizeGoal } from "./task-summary.js";
10
- import { branchNameForTaskFile, countTasks, findAcceptanceCriteria, hasNonEmptySection, isMvpTaskId, isOnTaskBranch, loadActionableTasks, readGitContext, statusDisplay, } from "./task.js";
11
- import { inferGuideStep, } from "./workflow-guide.js";
12
- function relTaskPath(cwd, filePath) {
13
- const r = relative(cwd, filePath).replace(/\\/g, "/");
14
- return r.startsWith("..") ? filePath : r;
15
- }
16
- function toBriefTask(cwd, meta) {
17
- return {
18
- id: meta.id,
19
- title: meta.title,
20
- status: statusDisplay(meta.status),
21
- mvpPhase: meta.mvpPhase,
22
- file: relTaskPath(cwd, meta.filePath),
23
- };
24
- }
25
- async function collectArtifacts(cwd, task) {
26
- const out = [];
27
- if (task === null)
28
- return out;
29
- if (isMvpTaskId(task.id) && (await pathExists(join(cwd, MVP_BUILD_PROMPT_REL)))) {
30
- out.push(MVP_BUILD_PROMPT_REL);
31
- }
32
- const buildRel = taskBuildPromptRel(task.id);
33
- if (await pathExists(join(cwd, buildRel)))
34
- out.push(buildRel);
35
- const implRel = cursorImplementPromptRel(task.id);
36
- if (await pathExists(join(cwd, implRel)))
37
- out.push(implRel);
38
- return out;
39
- }
40
- export async function collectTaskStatusBrief(cwd) {
41
- const paths = projectPaths(cwd);
42
- const config = await readConfig(cwd);
43
- const isVibeopsProject = config !== null;
44
- const emptyWorkflow = {
45
- stepId: "no-mvp",
46
- stepTitle: "No TASK yet",
47
- suggestedCommand: "vibeops plan",
48
- youDo: ["Run planning to create TASK-mvp and the build prompt."],
49
- };
50
- if (!isVibeopsProject) {
51
- const git = await readGitInfo(cwd);
52
- return {
53
- isVibeopsProject: false,
54
- projectName: null,
55
- mode: "greenfield",
56
- activeTask: null,
57
- referenceTask: null,
58
- inProgressTasks: [],
59
- counts: null,
60
- workflow: emptyWorkflow,
61
- git: {
62
- isRepo: git.isRepo,
63
- branch: git.branch,
64
- dirty: git.dirty,
65
- onTaskBranch: null,
66
- expectedTaskBranch: null,
67
- taskBranchExists: null,
68
- baseBranch: null,
69
- startedAt: null,
70
- },
71
- sections: null,
72
- artifacts: [],
73
- };
74
- }
75
- const guideCtx = await inferGuideStep({ cwd, paths, config });
76
- const actionable = await loadActionableTasks(paths.docsTasks);
77
- const counts = countTasks(actionable);
78
- const inProgress = actionable
79
- .filter((t) => t.status === "in_progress")
80
- .map((t) => toBriefTask(cwd, t));
81
- const active = guideCtx.task;
82
- const reference = guideCtx.referenceTask !== null ? toBriefTask(cwd, guideCtx.referenceTask) : null;
83
- let sections = null;
84
- let expectedBranch = null;
85
- let branchExists = null;
86
- let gitCtx = null;
87
- if (active !== null) {
88
- const body = await readText(active.filePath);
89
- gitCtx = await readGitContext(active.filePath);
90
- expectedBranch = branchNameForTaskFile(active.filePath);
91
- branchExists = await gitBranchExists(cwd, expectedBranch);
92
- sections = {
93
- goalExcerpt: summarizeGoal(body, 280),
94
- resultFilled: hasNonEmptySection(body, "Result"),
95
- testResultFilled: hasNonEmptySection(body, "Test Result"),
96
- acceptanceCriteriaCount: findAcceptanceCriteria(body).length,
97
- };
98
- }
99
- const git = await readGitInfo(cwd);
100
- const onTaskBranch = active !== null && gitCtx !== null ? isOnTaskBranch(git.branch, gitCtx) : null;
101
- const artifacts = await collectArtifacts(cwd, active);
102
- return {
103
- isVibeopsProject: true,
104
- projectName: config.name ?? null,
105
- mode: guideCtx.mode,
106
- activeTask: active !== null ? toBriefTask(cwd, active) : null,
107
- referenceTask: reference,
108
- inProgressTasks: inProgress,
109
- counts,
110
- workflow: {
111
- stepId: guideCtx.step.id,
112
- stepTitle: guideCtx.step.title,
113
- suggestedCommand: guideCtx.step.vibeopsCommand,
114
- youDo: guideCtx.step.youDo,
115
- },
116
- git: {
117
- isRepo: git.isRepo,
118
- branch: git.branch,
119
- dirty: git.dirty,
120
- onTaskBranch,
121
- expectedTaskBranch: expectedBranch ?? gitCtx?.taskBranch ?? null,
122
- taskBranchExists: branchExists,
123
- baseBranch: gitCtx?.baseBranch ?? null,
124
- startedAt: gitCtx?.startedAt ?? null,
125
- },
126
- sections,
127
- artifacts,
128
- };
129
- }
130
- export function taskStatusBriefToJson(brief) {
131
- return JSON.stringify(brief, null, 2);
132
- }