@goodtek/vibeops 0.7.22 → 1.0.0
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 +21 -1
- package/README.md +62 -382
- package/dist/bootstrap/installer.js +4 -16
- package/dist/cli.js +26 -160
- package/dist/commands/init.js +3 -3
- package/dist/commands/status.js +145 -8
- package/dist/commands/task-add.js +64 -164
- package/dist/commands/task-done.js +117 -74
- package/dist/lib/config.js +2 -118
- package/dist/lib/git.js +1 -1
- package/dist/lib/paths.js +7 -3
- package/dist/lib/plan-llm-openai.js +0 -63
- package/dist/lib/resolve-task.js +34 -0
- package/dist/lib/task-add-llm.js +46 -233
- package/dist/lib/task-context.js +68 -0
- package/dist/lib/task-done-llm.js +148 -0
- package/dist/lib/task-merge.js +54 -159
- package/dist/lib/task-scaffold.js +39 -43
- package/dist/lib/task-start.js +72 -0
- package/dist/lib/task-summary.js +12 -239
- package/dist/lib/task.js +15 -24
- package/dist/types/config.js +0 -16
- package/package.json +3 -5
- package/templates/.cursor/rules/01-task-source-of-truth.mdc +12 -0
- package/templates/.cursor/rules/02-git-safety.mdc +11 -0
- package/templates/.cursor/rules/03-docs-on-done.mdc +13 -0
- package/templates/.cursor/skills/implement-task/SKILL.md +22 -0
- package/templates/.cursor/skills/plan-task/SKILL.md +19 -0
- package/templates/AGENTS.md +26 -87
- package/templates/docs/logs/README.md +4 -35
- package/templates/docs/project/03-architecture.md +10 -29
- package/templates/docs/project/05-current-state.md +7 -27
- package/templates/docs/project/06-decisions.md +6 -17
- package/templates/docs/tasks/TASK-000-template.md +9 -44
- package/dist/agent/loader.js +0 -71
- package/dist/agent/prompt.js +0 -66
- package/dist/commands/agent-list.js +0 -32
- package/dist/commands/agent-prompt.js +0 -59
- package/dist/commands/agent-show.js +0 -26
- package/dist/commands/done.js +0 -160
- package/dist/commands/github-init.js +0 -554
- package/dist/commands/github-status.js +0 -164
- package/dist/commands/next.js +0 -283
- package/dist/commands/notion-init.js +0 -764
- package/dist/commands/notion-sync.js +0 -405
- package/dist/commands/notion-test.js +0 -595
- package/dist/commands/plan.js +0 -146
- package/dist/commands/rollback.js +0 -126
- package/dist/commands/start.js +0 -129
- package/dist/commands/task-check.js +0 -155
- package/dist/commands/task-generate.js +0 -206
- package/dist/commands/task-pull.js +0 -277
- package/dist/commands/task-rollback.js +0 -174
- package/dist/commands/task-start.js +0 -102
- package/dist/commands/task-status.js +0 -122
- package/dist/lib/brief.js +0 -356
- package/dist/lib/cursor-task-prompt.js +0 -60
- package/dist/lib/done-follow-up.js +0 -308
- package/dist/lib/github-cli.js +0 -247
- package/dist/lib/guide-state.js +0 -69
- package/dist/lib/mvp-artifacts.js +0 -204
- package/dist/lib/mvp-constants.js +0 -15
- package/dist/lib/mvp-diff-summary.js +0 -43
- package/dist/lib/mvp-done-summary.js +0 -335
- package/dist/lib/notion-client.js +0 -459
- package/dist/lib/notion-discovery.js +0 -671
- package/dist/lib/notion-env.js +0 -140
- package/dist/lib/notion-mappers.js +0 -148
- package/dist/lib/notion-schema.js +0 -272
- package/dist/lib/notion-sync.js +0 -337
- package/dist/lib/notion-target.js +0 -247
- package/dist/lib/package-json.js +0 -133
- package/dist/lib/plan-apply-planner.js +0 -131
- package/dist/lib/plan-codex-pkce.js +0 -234
- package/dist/lib/plan-llm-models.js +0 -237
- package/dist/lib/plan-llm-normalize.js +0 -146
- package/dist/lib/plan-llm-session.js +0 -682
- package/dist/lib/plan-post-apply-setup.js +0 -116
- package/dist/lib/project-docs.js +0 -95
- package/dist/lib/prompt-builder.js +0 -135
- package/dist/lib/resolve-command-task.js +0 -40
- package/dist/lib/task-add-build-prompt.js +0 -39
- package/dist/lib/task-add-cursor.js +0 -81
- package/dist/lib/task-generator.js +0 -183
- package/dist/lib/task-prompt.js +0 -23
- package/dist/lib/task-pull.js +0 -354
- package/dist/lib/task-status-brief.js +0 -132
- package/dist/lib/workflow-guide.js +0 -485
- package/dist/status/collector.js +0 -103
- package/dist/status/format.js +0 -181
- package/dist/types/brief.js +0 -126
- package/templates/.cursor/rules/00-project-governance.mdc +0 -28
- package/templates/.cursor/rules/01-agent-orchestration.mdc +0 -48
- package/templates/.cursor/rules/02-task-workflow.mdc +0 -38
- package/templates/.cursor/rules/03-git-safety.mdc +0 -30
- package/templates/.cursor/rules/04-docs-update.mdc +0 -22
- package/templates/.vibeops/agents/architect.md +0 -47
- package/templates/.vibeops/agents/builder.md +0 -38
- package/templates/.vibeops/agents/docs.md +0 -54
- package/templates/.vibeops/agents/orchestrator.md +0 -40
- package/templates/.vibeops/agents/planner.md +0 -60
- package/templates/.vibeops/agents/recovery.md +0 -49
- package/templates/.vibeops/agents/reviewer.md +0 -47
- package/templates/.vibeops/agents/tester.md +0 -43
- package/templates/.vibeops/prompts/create-plan.md +0 -33
- package/templates/.vibeops/prompts/generate-tasks.md +0 -41
- package/templates/.vibeops/prompts/implement-task.md +0 -39
- package/templates/.vibeops/prompts/review-task.md +0 -34
- package/templates/.vibeops/prompts/rollback.md +0 -32
- package/templates/.vibeops/prompts/start-project.md +0 -39
- package/templates/.vibeops/workflows/notion-sync.md +0 -53
- package/templates/.vibeops/workflows/project-start.md +0 -73
- package/templates/.vibeops/workflows/rollback.md +0 -45
- package/templates/.vibeops/workflows/task-lifecycle.md +0 -71
- package/templates/docs/project/00-overview.md +0 -27
- package/templates/docs/project/01-requirements.md +0 -30
- package/templates/docs/project/02-mvp-scope.md +0 -36
- package/templates/docs/project/04-tech-stack.md +0 -29
- package/templates/docs/project/07-backlog.md +0 -23
- package/templates/docs/project/08-env.md +0 -29
- package/templates/docs/project/09-deployment.md +0 -28
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
import { readConfig } from "../lib/config.js";
|
|
3
|
-
import { ghAuthStatus, gitRemoteList, isGhInstalled, parseGitHubRemote, } from "../lib/github-cli.js";
|
|
4
|
-
import { readBugsUrl, readHomepage, readPackageJson, readRepositoryUrl, } from "../lib/package-json.js";
|
|
5
|
-
import { bold, cyan, dim, green, log, yellow } from "../lib/logger.js";
|
|
6
|
-
async function collect(cwd) {
|
|
7
|
-
const [installed, auth, remotes, vibeopsConfig, pkg] = await Promise.all([
|
|
8
|
-
isGhInstalled(),
|
|
9
|
-
ghAuthStatus(),
|
|
10
|
-
gitRemoteList(cwd),
|
|
11
|
-
readConfig(cwd),
|
|
12
|
-
readPackageJson(cwd),
|
|
13
|
-
]);
|
|
14
|
-
const origin = remotes.find((r) => r.name === "origin") ?? null;
|
|
15
|
-
const otherGithub = remotes.find((r) => r.name !== "origin" && parseGitHubRemote(r.url).isGithub);
|
|
16
|
-
const chosen = origin ?? otherGithub ?? null;
|
|
17
|
-
const remote = chosen
|
|
18
|
-
? {
|
|
19
|
-
name: chosen.name,
|
|
20
|
-
url: chosen.url,
|
|
21
|
-
info: parseGitHubRemote(chosen.url),
|
|
22
|
-
}
|
|
23
|
-
: null;
|
|
24
|
-
return {
|
|
25
|
-
cwd,
|
|
26
|
-
gh: {
|
|
27
|
-
installed,
|
|
28
|
-
authenticated: auth.authenticated,
|
|
29
|
-
username: auth.username,
|
|
30
|
-
hosts: auth.hosts,
|
|
31
|
-
},
|
|
32
|
-
remote,
|
|
33
|
-
config: vibeopsConfig?.github
|
|
34
|
-
? {
|
|
35
|
-
enabled: vibeopsConfig.github.enabled,
|
|
36
|
-
mode: vibeopsConfig.github.mode,
|
|
37
|
-
owner: vibeopsConfig.github.owner,
|
|
38
|
-
repo: vibeopsConfig.github.repo,
|
|
39
|
-
remote: vibeopsConfig.github.remote,
|
|
40
|
-
visibility: vibeopsConfig.github.visibility,
|
|
41
|
-
url: vibeopsConfig.github.url,
|
|
42
|
-
}
|
|
43
|
-
: null,
|
|
44
|
-
package: pkg
|
|
45
|
-
? {
|
|
46
|
-
present: true,
|
|
47
|
-
repositoryUrl: readRepositoryUrl(pkg.data),
|
|
48
|
-
homepage: readHomepage(pkg.data),
|
|
49
|
-
bugsUrl: readBugsUrl(pkg.data),
|
|
50
|
-
}
|
|
51
|
-
: { present: false, repositoryUrl: "", homepage: "", bugsUrl: "" },
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function fmtRow(label, value, accent = "info") {
|
|
55
|
-
const padded = label.padEnd(20, " ");
|
|
56
|
-
const decorated = accent === "ok"
|
|
57
|
-
? green(value)
|
|
58
|
-
: accent === "warn"
|
|
59
|
-
? yellow(value)
|
|
60
|
-
: accent === "off"
|
|
61
|
-
? dim(value)
|
|
62
|
-
: value;
|
|
63
|
-
log.info(` ${padded} ${decorated}`);
|
|
64
|
-
}
|
|
65
|
-
function describeRemote(report) {
|
|
66
|
-
if (report.remote === null)
|
|
67
|
-
return { text: "none", accent: "off" };
|
|
68
|
-
const { info } = report.remote;
|
|
69
|
-
if (info.isGithub && info.owner !== null && info.repo !== null) {
|
|
70
|
-
return {
|
|
71
|
-
text: `${report.remote.name} ${info.owner}/${info.repo} ${dim(info.url)}`,
|
|
72
|
-
accent: "ok",
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
text: `${report.remote.name} ${report.remote.url} ${yellow("(not a GitHub URL)")}`,
|
|
77
|
-
accent: "warn",
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function describePackage(report) {
|
|
81
|
-
if (!report.package.present)
|
|
82
|
-
return { text: "none", accent: "off" };
|
|
83
|
-
const url = report.package.repositoryUrl;
|
|
84
|
-
if (url.length === 0)
|
|
85
|
-
return { text: "none", accent: "off" };
|
|
86
|
-
const info = parseGitHubRemote(url);
|
|
87
|
-
if (info.isGithub && info.owner !== null && info.repo !== null) {
|
|
88
|
-
return {
|
|
89
|
-
text: `${info.owner}/${info.repo} ${dim(url)}`,
|
|
90
|
-
accent: "ok",
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
return { text: `${url} ${yellow("(not a GitHub URL)")}`, accent: "warn" };
|
|
94
|
-
}
|
|
95
|
-
function describeConfig(report) {
|
|
96
|
-
if (report.config === null)
|
|
97
|
-
return { text: "no (no github section)", accent: "off" };
|
|
98
|
-
if (!report.config.enabled)
|
|
99
|
-
return {
|
|
100
|
-
text: `no (config present, enabled=false)`,
|
|
101
|
-
accent: "off",
|
|
102
|
-
};
|
|
103
|
-
const slug = report.config.owner.length > 0 && report.config.repo.length > 0
|
|
104
|
-
? `${report.config.owner}/${report.config.repo}`
|
|
105
|
-
: "(owner/repo missing)";
|
|
106
|
-
const visibility = report.config.visibility.length > 0 ? report.config.visibility : "?";
|
|
107
|
-
return {
|
|
108
|
-
text: `yes ${slug} visibility=${visibility} remote=${report.config.remote}`,
|
|
109
|
-
accent: report.config.owner.length > 0 && report.config.repo.length > 0 ? "ok" : "warn",
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
function printHuman(report) {
|
|
113
|
-
log.info(bold("GitHub"));
|
|
114
|
-
fmtRow("gh installed", report.gh.installed ? "yes" : "no", report.gh.installed ? "ok" : "off");
|
|
115
|
-
if (report.gh.installed) {
|
|
116
|
-
fmtRow("gh authenticated", report.gh.authenticated
|
|
117
|
-
? `yes${report.gh.username !== null ? ` ${dim(`as ${report.gh.username}`)}` : ""}`
|
|
118
|
-
: "no", report.gh.authenticated ? "ok" : "off");
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
fmtRow("gh authenticated", "n/a", "off");
|
|
122
|
-
}
|
|
123
|
-
const remote = describeRemote(report);
|
|
124
|
-
fmtRow("git remote origin", remote.text, remote.accent);
|
|
125
|
-
const cfg = describeConfig(report);
|
|
126
|
-
fmtRow("config enabled", cfg.text, cfg.accent);
|
|
127
|
-
const pkg = describePackage(report);
|
|
128
|
-
fmtRow("package repo", pkg.text, pkg.accent);
|
|
129
|
-
log.blank();
|
|
130
|
-
if (!report.gh.installed) {
|
|
131
|
-
log.info(`${yellow("!")} gh CLI not found. Install via ${cyan("brew install gh")} (macOS) and re-run.`);
|
|
132
|
-
}
|
|
133
|
-
else if (!report.gh.authenticated) {
|
|
134
|
-
log.info(`${yellow("!")} gh installed but not authenticated. Run ${cyan("gh auth login")} first.`);
|
|
135
|
-
}
|
|
136
|
-
else if (report.remote === null) {
|
|
137
|
-
log.info(`${dim("·")} No git remote yet. Run ${cyan("vibeops github init")} to create or connect one.`);
|
|
138
|
-
}
|
|
139
|
-
else if (!report.remote.info.isGithub) {
|
|
140
|
-
log.info(`${yellow("!")} ${report.remote.name} is not a GitHub URL. Reconnect with ${cyan("vibeops github init --connect <owner/repo>")}.`);
|
|
141
|
-
}
|
|
142
|
-
else if (report.config === null || !report.config.enabled) {
|
|
143
|
-
log.info(`${dim("·")} Remote OK, but .vibeops.json has no github section. Run ${cyan("vibeops github init")} to record it.`);
|
|
144
|
-
}
|
|
145
|
-
else if (report.package.present &&
|
|
146
|
-
parseGitHubRemote(report.package.repositoryUrl).isGithub === false) {
|
|
147
|
-
log.info(`${dim("·")} package.json repository fields are not GitHub URLs. Re-run ${cyan("vibeops github init")} to update them.`);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
log.ok("GitHub setup looks consistent.");
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
export async function githubStatusCommand(options = {}) {
|
|
154
|
-
const cwd = resolve(options.cwd ?? process.cwd());
|
|
155
|
-
const report = await collect(cwd);
|
|
156
|
-
if (options.json === true) {
|
|
157
|
-
log.raw(`${JSON.stringify(report, null, 2)}\n`);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
printHuman(report);
|
|
161
|
-
// Non-blocking: github status never sets a non-zero exit code by itself.
|
|
162
|
-
// The user is informed; nothing about gh missing / unauthenticated should
|
|
163
|
-
// break CI scripts that only call `vibeops github status` to probe state.
|
|
164
|
-
}
|
package/dist/commands/next.js
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
import { ensureCursorImplementPrompt } from "../lib/cursor-task-prompt.js";
|
|
3
|
-
import { readText } from "../lib/filesystem.js";
|
|
4
|
-
import { doneCommand } from "./done.js";
|
|
5
|
-
import { notionSyncCommand } from "./notion-sync.js";
|
|
6
|
-
import { startCommand } from "./start.js";
|
|
7
|
-
import { readConfig } from "../lib/config.js";
|
|
8
|
-
import { pathExists } from "../lib/filesystem.js";
|
|
9
|
-
import { popGuideHistory, pushGuideHistory, readGuideState, writeGuideState, } from "../lib/guide-state.js";
|
|
10
|
-
import { askSelect, yesNoSelect } from "../lib/inquirer-helpers.js";
|
|
11
|
-
import { bold, cyan, dim, green, log, yellow } from "../lib/logger.js";
|
|
12
|
-
import { projectPaths } from "../lib/paths.js";
|
|
13
|
-
import { statusDisplay } from "../lib/task.js";
|
|
14
|
-
import { excerptDoneSummary, LAST_DONE_SUMMARY_REL, readLastDoneSummary, } from "../lib/mvp-done-summary.js";
|
|
15
|
-
import { followUpStepId, guideStepRank, inferGuideStep, successorStepId, } from "../lib/workflow-guide.js";
|
|
16
|
-
const MENU_NEXT_RUN = "Next — run suggested step";
|
|
17
|
-
const MENU_NEXT_ADVANCE = "Next — check / advance step";
|
|
18
|
-
const MENU_PREV = "Previous step";
|
|
19
|
-
const MENU_REFRESH = "Refresh (re-detect from repo)";
|
|
20
|
-
const MENU_QUIT = "Quit";
|
|
21
|
-
async function renderPanel(ctx) {
|
|
22
|
-
const { step, task, gitBranch, gitDirty } = ctx;
|
|
23
|
-
log.blank();
|
|
24
|
-
log.info(bold("─".repeat(56)));
|
|
25
|
-
log.info(bold(" VibeOps · what's next"));
|
|
26
|
-
log.info(bold("─".repeat(56)));
|
|
27
|
-
if (task) {
|
|
28
|
-
log.info(` ${dim("TASK")} ${cyan(task.id)} — ${task.title || dim("(no title)")}`);
|
|
29
|
-
log.info(` ${dim("Status")} ${statusDisplay(task.status)}`);
|
|
30
|
-
if (gitBranch) {
|
|
31
|
-
log.info(` ${dim("Git")} ${gitBranch}${gitDirty === true ? yellow(" · dirty") : gitDirty === false ? green(" · clean") : ""}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else if (ctx.mode === "post-mvp" && ctx.referenceTask) {
|
|
35
|
-
log.info(` ${dim("TASK")} ${dim("(continue — last:")} ${cyan(ctx.referenceTask.id)} ${dim("done)")}`);
|
|
36
|
-
}
|
|
37
|
-
else if (ctx.mode === "post-mvp") {
|
|
38
|
-
log.info(` ${dim("TASK")} ${dim("(MVP complete — plan next slice)")}`);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
log.info(` ${dim("TASK")} ${dim("(none — run vibeops plan)")}`);
|
|
42
|
-
}
|
|
43
|
-
log.blank();
|
|
44
|
-
log.info(bold(` Step: ${step.title}`));
|
|
45
|
-
for (const line of step.youDo)
|
|
46
|
-
log.info(` ${dim("·")} ${line}`);
|
|
47
|
-
if (step.vibeopsCommand) {
|
|
48
|
-
log.blank();
|
|
49
|
-
log.info(` ${dim("Command")} ${cyan(step.vibeopsCommand)}`);
|
|
50
|
-
}
|
|
51
|
-
if (step.shellHints.length > 0) {
|
|
52
|
-
log.blank();
|
|
53
|
-
log.info(dim(" Shell:"));
|
|
54
|
-
for (const h of step.shellHints)
|
|
55
|
-
log.info(` ${dim("$")} ${h}`);
|
|
56
|
-
}
|
|
57
|
-
log.info(bold("─".repeat(56)));
|
|
58
|
-
if (ctx.task && (step.id === "implement" || step.id === "commit")) {
|
|
59
|
-
const body = await readText(ctx.task.filePath);
|
|
60
|
-
const cursorPrompt = await ensureCursorImplementPrompt(ctx.cwd, ctx.config, ctx.task, body);
|
|
61
|
-
if (cursorPrompt !== null) {
|
|
62
|
-
log.blank();
|
|
63
|
-
log.info(bold(" Cursor"));
|
|
64
|
-
const missing = [];
|
|
65
|
-
if (cursorPrompt.fillResult)
|
|
66
|
-
missing.push("Result");
|
|
67
|
-
if (cursorPrompt.fillTestResult)
|
|
68
|
-
missing.push("Test Result");
|
|
69
|
-
log.info(` ${dim("·")} ${missing.join(" / ")} not filled — start a chat and @-mention:`);
|
|
70
|
-
log.info(` ${cyan(cursorPrompt.rel)}`);
|
|
71
|
-
log.info(` ${dim("·")} Or open that file and send its contents as the first message.`);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const prior = await readLastDoneSummary(ctx.cwd);
|
|
75
|
-
if (prior !== null &&
|
|
76
|
-
(step.id === "no-mvp" ||
|
|
77
|
-
step.id === "all-done" ||
|
|
78
|
-
step.id === "continue-iteration" ||
|
|
79
|
-
task?.status === "done")) {
|
|
80
|
-
log.blank();
|
|
81
|
-
log.info(bold(" Previous iteration"));
|
|
82
|
-
for (const line of excerptDoneSummary(prior, 14).split("\n")) {
|
|
83
|
-
log.info(` ${dim(line)}`);
|
|
84
|
-
}
|
|
85
|
-
log.info(` ${dim("full")} ${cyan(LAST_DONE_SUMMARY_REL)}`);
|
|
86
|
-
}
|
|
87
|
-
log.blank();
|
|
88
|
-
}
|
|
89
|
-
async function runStep(ctx, step, dryRun, opts) {
|
|
90
|
-
if (dryRun && step.runnable) {
|
|
91
|
-
log.info(bold("dry-run — would run:"));
|
|
92
|
-
log.info(` ${cyan(step.vibeopsCommand ?? step.title)}`);
|
|
93
|
-
return { ok: true, advancedTo: step.id };
|
|
94
|
-
}
|
|
95
|
-
switch (step.id) {
|
|
96
|
-
case "start":
|
|
97
|
-
case "checkout-task": {
|
|
98
|
-
const ref = ctx.task?.id ?? "mvp";
|
|
99
|
-
await startCommand(ref, { cwd: ctx.cwd, dryRun: false });
|
|
100
|
-
return { ok: process.exitCode !== 1, advancedTo: "implement" };
|
|
101
|
-
}
|
|
102
|
-
case "finish": {
|
|
103
|
-
const ref = ctx.task?.id ?? "mvp";
|
|
104
|
-
await doneCommand(ref, {
|
|
105
|
-
cwd: ctx.cwd,
|
|
106
|
-
dryRun: false,
|
|
107
|
-
mergeViaPr: opts.mergeViaPr,
|
|
108
|
-
allowDirty: opts.allowDirty,
|
|
109
|
-
});
|
|
110
|
-
return {
|
|
111
|
-
ok: process.exitCode !== 1,
|
|
112
|
-
advancedTo: ctx.mode === "mvp" ? "all-done" : undefined,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
case "notion-sync":
|
|
116
|
-
await notionSyncCommand({ cwd: ctx.cwd, dryRun: false });
|
|
117
|
-
return { ok: process.exitCode !== 1, advancedTo: "all-done" };
|
|
118
|
-
default:
|
|
119
|
-
log.info(dim("Nothing to execute for this step."));
|
|
120
|
-
return { ok: true };
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
export async function nextCommand(options = {}) {
|
|
124
|
-
const cwd = resolve(options.cwd ?? process.cwd());
|
|
125
|
-
const paths = projectPaths(cwd);
|
|
126
|
-
if (!(await pathExists(paths.config))) {
|
|
127
|
-
log.error(`Not a VibeOps project. Run ${cyan("vibeops init")} first.`);
|
|
128
|
-
process.exitCode = 1;
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
const config = await readConfig(paths.root);
|
|
132
|
-
let guideState = await readGuideState(paths.vibeopsDir);
|
|
133
|
-
/** Set only after "Previous step" — one-shot forced step for display. */
|
|
134
|
-
let forceStepOnce;
|
|
135
|
-
const loadContext = async (forceStepId) => {
|
|
136
|
-
const inferred = await inferGuideStep({ cwd, paths, config });
|
|
137
|
-
const taskKey = inferred.task?.id ?? inferred.referenceTask?.id ?? null;
|
|
138
|
-
const saved = forceStepOnce ??
|
|
139
|
-
(guideState?.taskId === taskKey &&
|
|
140
|
-
guideState.stepId &&
|
|
141
|
-
guideStepRank(guideState.stepId) > guideStepRank(inferred.step.id)
|
|
142
|
-
? guideState.stepId
|
|
143
|
-
: undefined);
|
|
144
|
-
if (saved !== undefined && saved !== inferred.step.id) {
|
|
145
|
-
return inferGuideStep({ cwd, paths, config, forceStepId: saved });
|
|
146
|
-
}
|
|
147
|
-
return inferred;
|
|
148
|
-
};
|
|
149
|
-
const syncGuideStep = async (ctx) => {
|
|
150
|
-
if (forceStepOnce !== undefined)
|
|
151
|
-
return;
|
|
152
|
-
const taskKey = ctx.task?.id ?? ctx.referenceTask?.id ?? null;
|
|
153
|
-
if (guideState?.taskId === taskKey && guideState.stepId) {
|
|
154
|
-
if (guideStepRank(guideState.stepId) > guideStepRank(ctx.step.id))
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (guideState?.stepId === ctx.step.id && guideState?.taskId === taskKey)
|
|
158
|
-
return;
|
|
159
|
-
guideState = pushGuideHistory(guideState, taskKey, ctx.step.id);
|
|
160
|
-
await writeGuideState(paths.vibeopsDir, guideState);
|
|
161
|
-
};
|
|
162
|
-
if (options.nonInteractive === true) {
|
|
163
|
-
const ctx = await loadContext(undefined);
|
|
164
|
-
await renderPanel(ctx);
|
|
165
|
-
if (options.execute === true && ctx.step.runnable) {
|
|
166
|
-
await runStep(ctx, ctx.step, options.dryRun === true, options);
|
|
167
|
-
if (ctx.task) {
|
|
168
|
-
await writeGuideState(paths.vibeopsDir, pushGuideHistory(guideState, ctx.task.id, ctx.step.id));
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (!process.stdin.isTTY) {
|
|
174
|
-
const ctx = await loadContext(guideState?.stepId);
|
|
175
|
-
await renderPanel(ctx);
|
|
176
|
-
log.info(dim("Re-run in a terminal for the interactive menu."));
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
for (;;) {
|
|
180
|
-
const ctx = await loadContext(forceStepOnce);
|
|
181
|
-
forceStepOnce = undefined;
|
|
182
|
-
await syncGuideStep(ctx);
|
|
183
|
-
await renderPanel(ctx);
|
|
184
|
-
const menuNext = ctx.step.runnable ? MENU_NEXT_RUN : MENU_NEXT_ADVANCE;
|
|
185
|
-
const picked = await askSelect({
|
|
186
|
-
message: "Choose",
|
|
187
|
-
nonInteractive: false,
|
|
188
|
-
choices: [menuNext, MENU_PREV, MENU_REFRESH, MENU_QUIT],
|
|
189
|
-
default: menuNext,
|
|
190
|
-
});
|
|
191
|
-
if (picked === MENU_QUIT) {
|
|
192
|
-
log.info(dim("Resume with: vibeops next"));
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
if (picked === MENU_REFRESH) {
|
|
196
|
-
guideState = null;
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
if (picked === MENU_PREV) {
|
|
200
|
-
if (!guideState?.history.length) {
|
|
201
|
-
log.warn("No previous step in .vibeops/state/guide.json");
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
const popped = popGuideHistory(guideState);
|
|
205
|
-
guideState = popped.next;
|
|
206
|
-
if (popped.stepId)
|
|
207
|
-
forceStepOnce = popped.stepId;
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
const step = ctx.step;
|
|
211
|
-
if (!step.runnable) {
|
|
212
|
-
const body = ctx.task ? await readText(ctx.task.filePath) : "";
|
|
213
|
-
const fresh = await loadContext(undefined);
|
|
214
|
-
if (fresh.task?.id !== ctx.task?.id && ctx.task) {
|
|
215
|
-
log.warn(`Still on ${ctx.gitBranch ?? "task branch"} for ${ctx.task.id}. Run ${cyan(`vibeops done ${ctx.task.id}`)} (commit, merge, Notion) before starting ${fresh.task?.id ?? "another TASK"}.`);
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
if (fresh.step.runnable && fresh.step.id !== step.id) {
|
|
219
|
-
log.ok(`Step updated: ${bold(fresh.step.title)}`);
|
|
220
|
-
const go = await yesNoSelect({
|
|
221
|
-
message: `Run: ${fresh.step.vibeopsCommand ?? fresh.step.title}?`,
|
|
222
|
-
defaultValue: true,
|
|
223
|
-
});
|
|
224
|
-
if (!go)
|
|
225
|
-
continue;
|
|
226
|
-
const result = await runStep(fresh, fresh.step, options.dryRun === true, options);
|
|
227
|
-
if (!result.ok) {
|
|
228
|
-
log.warn("Step failed — fix the issue, then Refresh.");
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
const nextId = result.advancedTo ?? followUpStepId(fresh.step.id);
|
|
232
|
-
if (nextId !== null && nextId !== undefined) {
|
|
233
|
-
guideState = pushGuideHistory(guideState, fresh.task?.id ?? fresh.referenceTask?.id ?? null, nextId);
|
|
234
|
-
await writeGuideState(paths.vibeopsDir, guideState);
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
guideState = null;
|
|
238
|
-
}
|
|
239
|
-
guideState = await readGuideState(paths.vibeopsDir);
|
|
240
|
-
log.ok("Done.");
|
|
241
|
-
log.blank();
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
const succ = successorStepId(step.id, { body, gitDirty: ctx.gitDirty });
|
|
245
|
-
if (succ !== null && succ !== step.id) {
|
|
246
|
-
const go = await yesNoSelect({
|
|
247
|
-
message: `Move to next step (${succ})?`,
|
|
248
|
-
defaultValue: true,
|
|
249
|
-
});
|
|
250
|
-
if (!go)
|
|
251
|
-
continue;
|
|
252
|
-
guideState = pushGuideHistory(guideState, ctx.task?.id ?? null, succ);
|
|
253
|
-
await writeGuideState(paths.vibeopsDir, guideState);
|
|
254
|
-
log.ok(`Advanced to ${succ}.`);
|
|
255
|
-
log.blank();
|
|
256
|
-
continue;
|
|
257
|
-
}
|
|
258
|
-
log.info(dim("This step is manual (Cursor / git). Fill Result and Test Result, then choose Next again or Refresh."));
|
|
259
|
-
continue;
|
|
260
|
-
}
|
|
261
|
-
const go = await yesNoSelect({
|
|
262
|
-
message: `Run: ${step.vibeopsCommand ?? step.title}?`,
|
|
263
|
-
defaultValue: true,
|
|
264
|
-
});
|
|
265
|
-
if (!go)
|
|
266
|
-
continue;
|
|
267
|
-
const result = await runStep(ctx, step, options.dryRun === true, options);
|
|
268
|
-
if (!result.ok) {
|
|
269
|
-
log.warn("Step failed — fix the issue, then Refresh.");
|
|
270
|
-
continue;
|
|
271
|
-
}
|
|
272
|
-
const nextId = result.advancedTo ?? followUpStepId(step.id);
|
|
273
|
-
if (nextId !== null && nextId !== undefined) {
|
|
274
|
-
await writeGuideState(paths.vibeopsDir, pushGuideHistory(guideState, ctx.task?.id ?? ctx.referenceTask?.id ?? null, nextId));
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
guideState = null;
|
|
278
|
-
}
|
|
279
|
-
guideState = await readGuideState(paths.vibeopsDir);
|
|
280
|
-
log.ok(`Done. Refresh or Next for the following step.`);
|
|
281
|
-
log.blank();
|
|
282
|
-
}
|
|
283
|
-
}
|