@kw-yeh/vibeflow 4.11.57 → 4.11.58
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/README.md +2 -2
- package/dist/vibeflow.mjs +393 -200
- package/dist/web/404/index.html +1 -1
- package/dist/web/404.html +1 -1
- package/dist/web/_next/static/{E9TScKrKuQo0KJ8w6MXO4 → GTkU0wdIsq4m_7CMxYGnt}/_buildManifest.js +1 -1
- package/dist/web/_next/static/chunks/{8175-5d01c7c50275534e.js → 2362-46f5f7e798186269.js} +2 -2
- package/dist/web/_next/static/chunks/pages/_app-afd9eb2814f60818.js +1 -0
- package/dist/web/_next/static/chunks/pages/home-1b4098f1ae4f1d9b.js +13 -0
- package/dist/web/_next/static/css/{b72127b4ac8224ee.css → 775ca0d5cedbe9ea.css} +1 -1
- package/dist/web/home/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/_next/static/chunks/pages/_app-ba514e8a4a55baf5.js +0 -1
- package/dist/web/_next/static/chunks/pages/home-e16012828aaa8389.js +0 -13
- /package/dist/web/_next/static/{E9TScKrKuQo0KJ8w6MXO4 → GTkU0wdIsq4m_7CMxYGnt}/_ssgManifest.js +0 -0
package/dist/vibeflow.mjs
CHANGED
|
@@ -1229,7 +1229,7 @@ var init_progress = __esm({
|
|
|
1229
1229
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
1230
1230
|
import fs27 from "fs";
|
|
1231
1231
|
import os10 from "os";
|
|
1232
|
-
import
|
|
1232
|
+
import path29 from "path";
|
|
1233
1233
|
import React, { useEffect, useRef, useState } from "react";
|
|
1234
1234
|
import { Box, Text, render as render2, useApp, useInput } from "ink";
|
|
1235
1235
|
function newFormState(defaultAutoMode, agents) {
|
|
@@ -1366,8 +1366,8 @@ function editorCommand(env, platform) {
|
|
|
1366
1366
|
return env.VISUAL?.trim() || env.EDITOR?.trim() || (platform === "win32" ? "notepad" : "vi");
|
|
1367
1367
|
}
|
|
1368
1368
|
function editInEditor(text) {
|
|
1369
|
-
const dir = fs27.mkdtempSync(
|
|
1370
|
-
const file =
|
|
1369
|
+
const dir = fs27.mkdtempSync(path29.join(os10.tmpdir(), "vibeflow-"));
|
|
1370
|
+
const file = path29.join(dir, "description.md");
|
|
1371
1371
|
try {
|
|
1372
1372
|
fs27.writeFileSync(file, text);
|
|
1373
1373
|
const cmd = editorCommand(process.env, process.platform);
|
|
@@ -1447,9 +1447,9 @@ function FormView({ api, ctx, initial, initialFocus, initialMessage, pristine, o
|
|
|
1447
1447
|
if (editing === "title") setS((prev) => ({ ...prev, title: draft }));
|
|
1448
1448
|
else if (editing === "branch") setS((prev) => ({ ...prev, branch: value2 }));
|
|
1449
1449
|
else if (editing === "project") {
|
|
1450
|
-
if (value2) setProject(
|
|
1450
|
+
if (value2) setProject(path29.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir())));
|
|
1451
1451
|
} else if (editing === "attachments" && value2) {
|
|
1452
|
-
const file =
|
|
1452
|
+
const file = path29.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir()));
|
|
1453
1453
|
if (!fs27.existsSync(file) || !fs27.statSync(file).isFile()) {
|
|
1454
1454
|
setMessage(`\u627E\u4E0D\u5230\u6A94\u6848\uFF1A${file}`);
|
|
1455
1455
|
return;
|
|
@@ -1537,7 +1537,7 @@ function FormView({ api, ctx, initial, initialFocus, initialMessage, pristine, o
|
|
|
1537
1537
|
case "branch":
|
|
1538
1538
|
return s.branch || "\uFF08\u7559\u7A7A\u5247\u81EA\u52D5\u547D\u540D\uFF0C\u4F8B\u5982 feature/login-fix\uFF09";
|
|
1539
1539
|
case "attachments":
|
|
1540
|
-
return s.attachments.length ? s.attachments.map((a) =>
|
|
1540
|
+
return s.attachments.length ? s.attachments.map((a) => path29.basename(a)).join("\u3001") : "\uFF08Enter \u8F38\u5165\u6A94\u6848\u8DEF\u5F91\u52A0\u5165\uFF09";
|
|
1541
1541
|
case "description": {
|
|
1542
1542
|
if (!s.description) return "\uFF08Enter \u7528\u7DE8\u8F2F\u5668\u64B0\u5BEB\uFF09";
|
|
1543
1543
|
const lines = s.description.split("\n");
|
|
@@ -1572,7 +1572,7 @@ function FormView({ api, ctx, initial, initialFocus, initialMessage, pristine, o
|
|
|
1572
1572
|
if (info && !info.isRepo) return "\u9019\u500B\u8CC7\u6599\u593E\u4E0D\u662F Git repository\u3002\u8ACB\u6539\u9078\u4E00\u500B Git \u5C08\u6848\uFF0C\u6216\u5728\u4E0B\u65B9\u521D\u59CB\u5316\u3002";
|
|
1573
1573
|
if (s.mode === "edit" && projectChanged(s)) return "\u5206\u652F\u6703\u5728\u65B0\u5C08\u6848\u3001\u5361\u7247\u958B\u59CB\u57F7\u884C\u6642\u624D\u5EFA\u7ACB\u3002";
|
|
1574
1574
|
if (info?.isRepo && !info.hasRemote) return `\u6B64 repository \u6C92\u6709 remote\uFF0C\u5C07\u4EE5\u76EE\u524D\u5206\u652F (${info.currentBranch ?? "HEAD"}) \u70BA\u57FA\u6E96\u5EFA\u7ACB\u672C\u5730 worktree\u3002`;
|
|
1575
|
-
if (info?.isRepo && s.projectPath) return `worktree \u6703\u5EFA\u5728 ${ctx.workstationPath || "~/Desktop"}/${
|
|
1575
|
+
if (info?.isRepo && s.projectPath) return `worktree \u6703\u5EFA\u5728 ${ctx.workstationPath || "~/Desktop"}/${path29.basename(s.projectPath)}`;
|
|
1576
1576
|
}
|
|
1577
1577
|
if (field === "branch") {
|
|
1578
1578
|
const when = info?.hasRemote ? "\u958B\u59CB\u57F7\u884C\u6642\u6703\u5EFA\u7ACB\u540C\u540D\u5206\u652F\u4E26\u63A8\u5230 origin\uFF1B\u82E5 remote \u5DF2\u6709\u9019\u500B\u5206\u652F\uFF0C\u5247\u76F4\u63A5\u53D6\u56DE\u4E26\u63A5\u7E8C\u4E0A\u9762\u7684\u5DE5\u4F5C\u3002" : "\u958B\u59CB\u57F7\u884C\u6642\u6703\u5EFA\u7ACB\u540C\u540D\u5206\u652F\u3002";
|
|
@@ -1702,7 +1702,7 @@ __export(src_exports, {
|
|
|
1702
1702
|
showDiff: () => showDiff
|
|
1703
1703
|
});
|
|
1704
1704
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
1705
|
-
import
|
|
1705
|
+
import path30 from "path";
|
|
1706
1706
|
import React2, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
1707
1707
|
import { Box as Box2, Text as Text2, render as render3, useApp as useApp2, useInput as useInput2, useStdout } from "ink";
|
|
1708
1708
|
function findDetachKey(text) {
|
|
@@ -2001,7 +2001,7 @@ function showDiff(task) {
|
|
|
2001
2001
|
});
|
|
2002
2002
|
}
|
|
2003
2003
|
function tmuxAttach(opts, sessionName) {
|
|
2004
|
-
const conf =
|
|
2004
|
+
const conf = path30.join(opts.userDataDir, "tmux.conf");
|
|
2005
2005
|
const inOurServer = (process.env.TMUX ?? "").split(",")[0].endsWith(`/${TMUX_SOCKET}`);
|
|
2006
2006
|
const args = inOurServer ? ["-L", TMUX_SOCKET, "-f", conf, "switch-client", "-t", `=${sessionName}`] : ["-L", TMUX_SOCKET, "-f", conf, "attach-session", "-t", `=${sessionName}`];
|
|
2007
2007
|
spawnSync3("tmux", args, { stdio: "inherit", env: { ...process.env, TMUX: inOurServer ? process.env.TMUX : "" } });
|
|
@@ -2133,7 +2133,7 @@ var init_src = __esm({
|
|
|
2133
2133
|
|
|
2134
2134
|
// packages/cli/src/main.ts
|
|
2135
2135
|
import fs28 from "fs";
|
|
2136
|
-
import
|
|
2136
|
+
import path31 from "path";
|
|
2137
2137
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
2138
2138
|
import { parseArgs as parseArgs2 } from "node:util";
|
|
2139
2139
|
import { spawn as spawn9 } from "node:child_process";
|
|
@@ -2678,6 +2678,14 @@ function createBridge(t) {
|
|
|
2678
2678
|
getDiffEntries: (taskId, opts) => t.invoke("git:getDiffEntries", taskId, opts),
|
|
2679
2679
|
/** Content for one changed file, loaded when its row is expanded. */
|
|
2680
2680
|
getDiffFile: (taskId, filePath) => t.invoke("git:getDiffFile", taskId, filePath),
|
|
2681
|
+
/** A running card's commits and its uncommitted summary; null without a worktree. */
|
|
2682
|
+
listCommits: (taskId) => t.invoke("git:listCommits", taskId),
|
|
2683
|
+
/** Files of one branch commit, or of `'working'` (the uncommitted changes). */
|
|
2684
|
+
getCommitEntries: (taskId, ref) => t.invoke("git:getCommitEntries", taskId, ref),
|
|
2685
|
+
getCommitFile: (taskId, ref, filePath) => t.invoke("git:getCommitFile", taskId, ref, filePath),
|
|
2686
|
+
/** One commit a done card recorded: from the base, else from its PR via gh. */
|
|
2687
|
+
getDoneCommitDiff: (taskId, sha) => t.invoke("git:getDoneCommitDiff", taskId, sha),
|
|
2688
|
+
getDoneCommitFile: (taskId, sha, filePath) => t.invoke("git:getDoneCommitFile", taskId, sha, filePath),
|
|
2681
2689
|
/** Temporary artifacts the agent wrote for this task (metadata only). */
|
|
2682
2690
|
listArtifacts: (taskId) => t.invoke("task:listArtifacts", taskId),
|
|
2683
2691
|
/** Content of one artifact, by its name relative to the artifacts dir. */
|
|
@@ -2687,8 +2695,6 @@ function createBridge(t) {
|
|
|
2687
2695
|
* in-app preview will not inline. Resolves to '' on success, else a reason.
|
|
2688
2696
|
*/
|
|
2689
2697
|
openArtifactsDir: (taskId) => t.invoke("task:openArtifactsDir", taskId),
|
|
2690
|
-
/** Every spec.md the task's branch added or changed; empty when there is none. */
|
|
2691
|
-
getSpecs: (taskId) => t.invoke("task:getSpecs", taskId),
|
|
2692
2698
|
/** Store dir + CLI paths for launch injection, so an agent can write cards. */
|
|
2693
2699
|
getBoardCliLaunchInfo: () => t.invoke("board:getCliLaunchInfo"),
|
|
2694
2700
|
/** VibeFlow's own skill / prompt / script store. */
|
|
@@ -2749,9 +2755,9 @@ function createBridge(t) {
|
|
|
2749
2755
|
},
|
|
2750
2756
|
// Interactive terminal bridge (Phase 3).
|
|
2751
2757
|
term: {
|
|
2752
|
-
readFile: (sessionKey,
|
|
2758
|
+
readFile: (sessionKey, path32) => t.invoke("terminal:readFile", { sessionKey, path: path32 }),
|
|
2753
2759
|
existingFiles: (sessionKey, paths) => t.invoke("terminal:existingFiles", { sessionKey, paths }),
|
|
2754
|
-
openFile: (sessionKey,
|
|
2760
|
+
openFile: (sessionKey, path32) => t.invoke("terminal:openFile", { sessionKey, path: path32 }),
|
|
2755
2761
|
/**
|
|
2756
2762
|
* Start a terminal for a task: its agent when `launch` is given, else an
|
|
2757
2763
|
* interactive shell. Core resolves the cwd and builds the command.
|
|
@@ -4167,7 +4173,7 @@ async function fetchBase(worktreePath, baseBranch) {
|
|
|
4167
4173
|
} catch {
|
|
4168
4174
|
}
|
|
4169
4175
|
}
|
|
4170
|
-
async function
|
|
4176
|
+
async function buildDiffEntries(cwd, query) {
|
|
4171
4177
|
const entryMap = /* @__PURE__ */ new Map();
|
|
4172
4178
|
function parseNameStatus(output) {
|
|
4173
4179
|
for (const line of output.split("\n").map((l) => l.trim()).filter(Boolean)) {
|
|
@@ -4193,29 +4199,16 @@ async function collectDiffEntries(worktreePath, baseRef) {
|
|
|
4193
4199
|
entry.deletions = Number.parseInt(parts[1], 10) || 0;
|
|
4194
4200
|
}
|
|
4195
4201
|
}
|
|
4196
|
-
|
|
4197
|
-
await git(
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
"ls-files",
|
|
4207
|
-
"--others",
|
|
4208
|
-
"--exclude-standard"
|
|
4209
|
-
]).catch(() => "");
|
|
4210
|
-
for (const p of untracked.split("\n").map((l) => l.trim()).filter(Boolean)) {
|
|
4211
|
-
if (!entryMap.has(p)) {
|
|
4212
|
-
entryMap.set(p, {
|
|
4213
|
-
path: p,
|
|
4214
|
-
status: "?",
|
|
4215
|
-
additions: 0,
|
|
4216
|
-
deletions: 0,
|
|
4217
|
-
revision: ""
|
|
4218
|
-
});
|
|
4202
|
+
for (const args of query.nameStatus) {
|
|
4203
|
+
parseNameStatus(await git(cwd, args).catch(() => ""));
|
|
4204
|
+
}
|
|
4205
|
+
parseNumstat(await git(cwd, query.numstat).catch(() => ""));
|
|
4206
|
+
if (query.untracked) {
|
|
4207
|
+
const untracked = await git(cwd, ["ls-files", "--others", "--exclude-standard"]).catch(() => "");
|
|
4208
|
+
for (const p of untracked.split("\n").map((l) => l.trim()).filter(Boolean)) {
|
|
4209
|
+
if (!entryMap.has(p)) {
|
|
4210
|
+
entryMap.set(p, { path: p, status: "?", additions: 0, deletions: 0, revision: "" });
|
|
4211
|
+
}
|
|
4219
4212
|
}
|
|
4220
4213
|
}
|
|
4221
4214
|
const entries = Array.from(entryMap.values()).filter(
|
|
@@ -4223,10 +4216,14 @@ async function collectDiffEntries(worktreePath, baseRef) {
|
|
|
4223
4216
|
(dir) => e.path === dir || e.path.startsWith(`${dir}/`)
|
|
4224
4217
|
)
|
|
4225
4218
|
);
|
|
4219
|
+
if (query.revision !== void 0) {
|
|
4220
|
+
for (const entry of entries) entry.revision = `${query.revision}:${entry.path}`;
|
|
4221
|
+
return entries;
|
|
4222
|
+
}
|
|
4226
4223
|
await Promise.all(
|
|
4227
4224
|
entries.map(async (entry) => {
|
|
4228
4225
|
try {
|
|
4229
|
-
const stat = await fs9.stat(path12.join(
|
|
4226
|
+
const stat = await fs9.stat(path12.join(cwd, entry.path));
|
|
4230
4227
|
entry.revision = `${stat.mtimeMs}:${stat.size}`;
|
|
4231
4228
|
} catch {
|
|
4232
4229
|
entry.revision = `${entry.status}:${entry.additions}:${entry.deletions}`;
|
|
@@ -4235,20 +4232,50 @@ async function collectDiffEntries(worktreePath, baseRef) {
|
|
|
4235
4232
|
);
|
|
4236
4233
|
return entries;
|
|
4237
4234
|
}
|
|
4238
|
-
|
|
4235
|
+
function collectDiffEntries(worktreePath, baseRef) {
|
|
4236
|
+
return buildDiffEntries(worktreePath, {
|
|
4237
|
+
nameStatus: [
|
|
4238
|
+
["diff", "--name-status", `${baseRef}...HEAD`],
|
|
4239
|
+
["diff", "--name-status", "HEAD"]
|
|
4240
|
+
],
|
|
4241
|
+
numstat: ["diff", "--numstat", baseRef],
|
|
4242
|
+
untracked: true
|
|
4243
|
+
});
|
|
4244
|
+
}
|
|
4245
|
+
function collectWorkingEntries(worktreePath) {
|
|
4246
|
+
return buildDiffEntries(worktreePath, {
|
|
4247
|
+
nameStatus: [["diff", "--name-status", "HEAD"]],
|
|
4248
|
+
numstat: ["diff", "--numstat", "HEAD"],
|
|
4249
|
+
untracked: true
|
|
4250
|
+
});
|
|
4251
|
+
}
|
|
4252
|
+
async function firstParent(cwd, sha) {
|
|
4253
|
+
return git(cwd, ["rev-parse", "--verify", "--quiet", `${sha}^1`]).catch(() => `${sha}^1`);
|
|
4254
|
+
}
|
|
4255
|
+
function collectCommitEntries(cwd, sha) {
|
|
4256
|
+
const show = ["show", "--format=", "--diff-merges=first-parent"];
|
|
4257
|
+
return buildDiffEntries(cwd, {
|
|
4258
|
+
nameStatus: [[...show, "--name-status", sha]],
|
|
4259
|
+
numstat: [...show, "--numstat", sha],
|
|
4260
|
+
untracked: false,
|
|
4261
|
+
revision: sha
|
|
4262
|
+
});
|
|
4263
|
+
}
|
|
4264
|
+
async function readEntryFile(cwd, oldRef, newRef, entry) {
|
|
4239
4265
|
let oldValue = "";
|
|
4240
4266
|
if (entry.status !== "A" && entry.status !== "?") {
|
|
4241
|
-
oldValue = await git(
|
|
4242
|
-
"show",
|
|
4243
|
-
`${baseRef}:${entry.path}`
|
|
4244
|
-
]).catch(() => "");
|
|
4267
|
+
oldValue = await git(cwd, ["show", `${oldRef}:${entry.path}`]).catch(() => "");
|
|
4245
4268
|
}
|
|
4246
4269
|
let newValue = "";
|
|
4247
4270
|
if (entry.status !== "D") {
|
|
4248
|
-
|
|
4249
|
-
newValue = await
|
|
4250
|
-
}
|
|
4251
|
-
|
|
4271
|
+
if (newRef) {
|
|
4272
|
+
newValue = await git(cwd, ["show", `${newRef}:${entry.path}`]).catch(() => "");
|
|
4273
|
+
} else {
|
|
4274
|
+
try {
|
|
4275
|
+
newValue = await fs9.readFile(path12.join(cwd, entry.path), "utf8");
|
|
4276
|
+
} catch {
|
|
4277
|
+
newValue = await git(cwd, ["show", `HEAD:${entry.path}`]).catch(() => "");
|
|
4278
|
+
}
|
|
4252
4279
|
}
|
|
4253
4280
|
}
|
|
4254
4281
|
const oldClip = clip(oldValue);
|
|
@@ -4260,6 +4287,9 @@ async function readDiffFile(worktreePath, baseRef, entry) {
|
|
|
4260
4287
|
truncated: oldClip.truncated || newClip.truncated
|
|
4261
4288
|
};
|
|
4262
4289
|
}
|
|
4290
|
+
function readDiffFile(worktreePath, baseRef, entry) {
|
|
4291
|
+
return readEntryFile(worktreePath, baseRef, null, entry);
|
|
4292
|
+
}
|
|
4263
4293
|
async function getWorktreeDiffEntries(worktreePath, baseBranch, opts) {
|
|
4264
4294
|
if (opts?.fetch !== false) await fetchBase(worktreePath, baseBranch);
|
|
4265
4295
|
const baseRef = await resolveBaseRef(worktreePath, baseBranch);
|
|
@@ -5139,7 +5169,7 @@ async function hostCommand(sub, values, storePath) {
|
|
|
5139
5169
|
|
|
5140
5170
|
// packages/cli/src/host.ts
|
|
5141
5171
|
import fs25 from "fs";
|
|
5142
|
-
import
|
|
5172
|
+
import path27 from "path";
|
|
5143
5173
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
5144
5174
|
|
|
5145
5175
|
// packages/core/src/events.ts
|
|
@@ -5770,7 +5800,7 @@ async function readTerminalFile(cwd, input, metadataOnly = false) {
|
|
|
5770
5800
|
|
|
5771
5801
|
// packages/core/src/service.ts
|
|
5772
5802
|
import os9 from "os";
|
|
5773
|
-
import
|
|
5803
|
+
import path23 from "path";
|
|
5774
5804
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
5775
5805
|
|
|
5776
5806
|
// packages/core/src/agent-models.ts
|
|
@@ -6870,24 +6900,233 @@ function createJiraService(options) {
|
|
|
6870
6900
|
};
|
|
6871
6901
|
}
|
|
6872
6902
|
|
|
6873
|
-
// packages/core/src/
|
|
6903
|
+
// packages/core/src/commit-diff.ts
|
|
6904
|
+
init_launch();
|
|
6874
6905
|
import fs17 from "fs";
|
|
6906
|
+
var WORKING_CHANGES = "working";
|
|
6907
|
+
var SHA_RE = /^[0-9a-f]{4,40}$/i;
|
|
6908
|
+
function isCommitSha(value) {
|
|
6909
|
+
return typeof value === "string" && SHA_RE.test(value);
|
|
6910
|
+
}
|
|
6911
|
+
var isMetadataPath = (p) => [SUBAGENTS_DIR, PROGRESS_EVENTS_DIR].some((dir) => p === dir || p.startsWith(`${dir}/`));
|
|
6912
|
+
var COMMIT_LOG_FORMAT = "%x01%H%x00%h%x00%s%x00%at%x00%P";
|
|
6913
|
+
async function listBranchCommits(worktreePath, baseRef) {
|
|
6914
|
+
const out = await git(worktreePath, [
|
|
6915
|
+
"log",
|
|
6916
|
+
`--format=${COMMIT_LOG_FORMAT}`,
|
|
6917
|
+
"--numstat",
|
|
6918
|
+
"--diff-merges=first-parent",
|
|
6919
|
+
`--max-count=${MAX_OUTCOME_COMMITS + 1}`,
|
|
6920
|
+
`${baseRef}..HEAD`
|
|
6921
|
+
]).catch(() => "");
|
|
6922
|
+
const commits = [];
|
|
6923
|
+
for (const record2 of out.split("")) {
|
|
6924
|
+
const lines = record2.split("\n");
|
|
6925
|
+
const header = lines[0]?.split("\0");
|
|
6926
|
+
if (!header || header.length < 5) continue;
|
|
6927
|
+
const [sha, shortSha, subject, at, parents] = header;
|
|
6928
|
+
let additions = 0;
|
|
6929
|
+
let deletions = 0;
|
|
6930
|
+
let fileCount = 0;
|
|
6931
|
+
for (const line of lines.slice(1)) {
|
|
6932
|
+
const parts = line.split(" ");
|
|
6933
|
+
if (parts.length < 3 || isMetadataPath(parts[parts.length - 1])) continue;
|
|
6934
|
+
fileCount++;
|
|
6935
|
+
additions += Number.parseInt(parts[0], 10) || 0;
|
|
6936
|
+
deletions += Number.parseInt(parts[1], 10) || 0;
|
|
6937
|
+
}
|
|
6938
|
+
commits.push({
|
|
6939
|
+
sha,
|
|
6940
|
+
shortSha,
|
|
6941
|
+
subject,
|
|
6942
|
+
authoredAt: (Number.parseInt(at, 10) || 0) * 1e3,
|
|
6943
|
+
isMerge: parents.trim().split(/\s+/).filter(Boolean).length > 1,
|
|
6944
|
+
additions,
|
|
6945
|
+
deletions,
|
|
6946
|
+
fileCount
|
|
6947
|
+
});
|
|
6948
|
+
}
|
|
6949
|
+
return {
|
|
6950
|
+
commits: commits.slice(0, MAX_OUTCOME_COMMITS),
|
|
6951
|
+
truncated: commits.length > MAX_OUTCOME_COMMITS
|
|
6952
|
+
};
|
|
6953
|
+
}
|
|
6954
|
+
function summarize(entries) {
|
|
6955
|
+
if (entries.length === 0) return null;
|
|
6956
|
+
return {
|
|
6957
|
+
fileCount: entries.length,
|
|
6958
|
+
additions: entries.reduce((sum, e) => sum + e.additions, 0),
|
|
6959
|
+
deletions: entries.reduce((sum, e) => sum + e.deletions, 0)
|
|
6960
|
+
};
|
|
6961
|
+
}
|
|
6962
|
+
async function getBranchCommits(worktreePath, baseBranch) {
|
|
6963
|
+
const baseRef = await resolveBaseRef(worktreePath, baseBranch);
|
|
6964
|
+
const [{ commits, truncated }, working] = await Promise.all([
|
|
6965
|
+
listBranchCommits(worktreePath, baseRef),
|
|
6966
|
+
collectWorkingEntries(worktreePath)
|
|
6967
|
+
]);
|
|
6968
|
+
return { commits, working: summarize(working), truncated };
|
|
6969
|
+
}
|
|
6970
|
+
async function resolveCommit(cwd, sha) {
|
|
6971
|
+
return git(cwd, ["rev-parse", "--verify", "--quiet", `${sha}^{commit}`]).catch(() => null);
|
|
6972
|
+
}
|
|
6973
|
+
async function isAncestor(cwd, sha, ref) {
|
|
6974
|
+
return git(cwd, ["merge-base", "--is-ancestor", sha, ref]).then(
|
|
6975
|
+
() => true,
|
|
6976
|
+
() => false
|
|
6977
|
+
);
|
|
6978
|
+
}
|
|
6979
|
+
async function resolveBranchCommit(worktreePath, baseBranch, sha) {
|
|
6980
|
+
const full = await resolveCommit(worktreePath, sha);
|
|
6981
|
+
if (!full) return null;
|
|
6982
|
+
const baseRef = await resolveBaseRef(worktreePath, baseBranch);
|
|
6983
|
+
if (!await isAncestor(worktreePath, full, "HEAD")) return null;
|
|
6984
|
+
if (await isAncestor(worktreePath, full, baseRef)) return null;
|
|
6985
|
+
return full;
|
|
6986
|
+
}
|
|
6987
|
+
async function getCommitEntries(worktreePath, baseBranch, ref) {
|
|
6988
|
+
if (ref === WORKING_CHANGES) {
|
|
6989
|
+
return (await collectWorkingEntries(worktreePath)).slice(0, MAX_DIFF_FILES);
|
|
6990
|
+
}
|
|
6991
|
+
const full = await resolveBranchCommit(worktreePath, baseBranch, ref);
|
|
6992
|
+
if (!full) return null;
|
|
6993
|
+
return (await collectCommitEntries(worktreePath, full)).slice(0, MAX_DIFF_FILES);
|
|
6994
|
+
}
|
|
6995
|
+
async function getCommitFile(worktreePath, baseBranch, ref, filePath) {
|
|
6996
|
+
if (ref === WORKING_CHANGES) {
|
|
6997
|
+
const entry2 = (await collectWorkingEntries(worktreePath)).find((e) => e.path === filePath);
|
|
6998
|
+
return entry2 ? readEntryFile(worktreePath, "HEAD", null, entry2) : null;
|
|
6999
|
+
}
|
|
7000
|
+
const full = await resolveBranchCommit(worktreePath, baseBranch, ref);
|
|
7001
|
+
if (!full) return null;
|
|
7002
|
+
const entry = (await collectCommitEntries(worktreePath, full)).find((e) => e.path === filePath);
|
|
7003
|
+
if (!entry) return null;
|
|
7004
|
+
return readEntryFile(worktreePath, await firstParent(worktreePath, full), full, entry);
|
|
7005
|
+
}
|
|
7006
|
+
async function resolveCommitInBase(projectPath, baseBranch, sha, opts) {
|
|
7007
|
+
if (!fs17.existsSync(projectPath)) return null;
|
|
7008
|
+
if (opts?.fetch) await fetchBase(projectPath, baseBranch);
|
|
7009
|
+
const full = await resolveCommit(projectPath, sha);
|
|
7010
|
+
if (!full) return null;
|
|
7011
|
+
const baseRef = await resolveBaseRef(projectPath, baseBranch);
|
|
7012
|
+
return await isAncestor(projectPath, full, baseRef) ? full : null;
|
|
7013
|
+
}
|
|
7014
|
+
var PR_URL_RE = /^https:\/\/github\.com\/([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)\/pull\/(\d+)(?:[/?#].*)?$/;
|
|
7015
|
+
function parsePrUrl(url) {
|
|
7016
|
+
const match = PR_URL_RE.exec(url);
|
|
7017
|
+
if (!match || match[1].split("/").some((part) => part === "." || part === "..")) return null;
|
|
7018
|
+
return { repo: match[1], number: Number(match[2]) };
|
|
7019
|
+
}
|
|
7020
|
+
var GITHUB_STATUS = {
|
|
7021
|
+
added: "A",
|
|
7022
|
+
removed: "D",
|
|
7023
|
+
modified: "M",
|
|
7024
|
+
renamed: "R",
|
|
7025
|
+
copied: "C",
|
|
7026
|
+
changed: "M",
|
|
7027
|
+
unchanged: "M"
|
|
7028
|
+
};
|
|
7029
|
+
function parseGithubCommitFiles(json) {
|
|
7030
|
+
const parsed = JSON.parse(json);
|
|
7031
|
+
const raw = Array.isArray(parsed?.files) ? parsed.files : [];
|
|
7032
|
+
const files = [];
|
|
7033
|
+
for (const f of raw) {
|
|
7034
|
+
if (typeof f?.filename !== "string" || isMetadataPath(f.filename)) continue;
|
|
7035
|
+
const file = {
|
|
7036
|
+
path: f.filename,
|
|
7037
|
+
status: GITHUB_STATUS[String(f.status)] ?? "M",
|
|
7038
|
+
additions: typeof f.additions === "number" ? f.additions : 0,
|
|
7039
|
+
deletions: typeof f.deletions === "number" ? f.deletions : 0
|
|
7040
|
+
};
|
|
7041
|
+
if (typeof f.patch === "string") {
|
|
7042
|
+
const clipped = clip(f.patch);
|
|
7043
|
+
file.patch = clipped.value;
|
|
7044
|
+
if (clipped.truncated) file.truncated = true;
|
|
7045
|
+
}
|
|
7046
|
+
files.push(file);
|
|
7047
|
+
}
|
|
7048
|
+
return { files: files.slice(0, MAX_DIFF_FILES), truncated: files.length > MAX_DIFF_FILES };
|
|
7049
|
+
}
|
|
7050
|
+
function ghError(err) {
|
|
7051
|
+
const e = err;
|
|
7052
|
+
if (e?.code === "ENOENT") return "\u627E\u4E0D\u5230 gh \u6307\u4EE4";
|
|
7053
|
+
const text = String(e?.stderr || e?.message || err).trim();
|
|
7054
|
+
return text.split("\n")[0] || "gh \u57F7\u884C\u5931\u6557";
|
|
7055
|
+
}
|
|
7056
|
+
async function readGithubCommit(pr, sha, runGh) {
|
|
7057
|
+
let shas;
|
|
7058
|
+
try {
|
|
7059
|
+
const out = await runGh([
|
|
7060
|
+
"api",
|
|
7061
|
+
`repos/${pr.repo}/pulls/${pr.number}/commits?per_page=100`,
|
|
7062
|
+
"--paginate",
|
|
7063
|
+
"--jq",
|
|
7064
|
+
".[].sha"
|
|
7065
|
+
]);
|
|
7066
|
+
shas = out.split("\n").map((l) => l.trim().toLowerCase()).filter(Boolean);
|
|
7067
|
+
} catch (err) {
|
|
7068
|
+
return { source: "none", reason: `base \u4E2D\u627E\u4E0D\u5230\u9019\u500B commit\uFF0C\u900F\u904E gh \u8B80\u53D6 PR #${pr.number} \u4E5F\u5931\u6557\uFF1A${ghError(err)}` };
|
|
7069
|
+
}
|
|
7070
|
+
const matches = [...new Set(shas.filter((s) => s.startsWith(sha.toLowerCase())))];
|
|
7071
|
+
if (matches.length !== 1) {
|
|
7072
|
+
return {
|
|
7073
|
+
source: "none",
|
|
7074
|
+
reason: matches.length === 0 ? `base \u4E2D\u627E\u4E0D\u5230\u9019\u500B commit\uFF0CPR #${pr.number} \u7684 commit \u4E2D\u4E5F\u6C92\u6709\u5B83\u3002` : `PR #${pr.number} \u4E2D\u6709\u591A\u500B commit \u7B26\u5408 ${sha}\uFF0C\u7121\u6CD5\u5224\u65B7\u662F\u54EA\u4E00\u500B\u3002`
|
|
7075
|
+
};
|
|
7076
|
+
}
|
|
7077
|
+
try {
|
|
7078
|
+
const json = await runGh(["api", `repos/${pr.repo}/commits/${matches[0]}`]);
|
|
7079
|
+
const { files, truncated } = parseGithubCommitFiles(json);
|
|
7080
|
+
return { source: "github", sha: matches[0], files, truncated };
|
|
7081
|
+
} catch (err) {
|
|
7082
|
+
return { source: "none", reason: `\u900F\u904E gh \u8B80\u53D6\u9019\u500B commit \u5931\u6557\uFF1A${ghError(err)}` };
|
|
7083
|
+
}
|
|
7084
|
+
}
|
|
7085
|
+
async function getDoneCommitDiff(input) {
|
|
7086
|
+
if (input.projectPath) {
|
|
7087
|
+
const full = await resolveCommitInBase(input.projectPath, input.baseBranch, input.sha, {
|
|
7088
|
+
fetch: true
|
|
7089
|
+
});
|
|
7090
|
+
if (full) {
|
|
7091
|
+
const entries = await collectCommitEntries(input.projectPath, full);
|
|
7092
|
+
return {
|
|
7093
|
+
source: "git",
|
|
7094
|
+
sha: full,
|
|
7095
|
+
files: entries.slice(0, MAX_DIFF_FILES),
|
|
7096
|
+
truncated: entries.length > MAX_DIFF_FILES
|
|
7097
|
+
};
|
|
7098
|
+
}
|
|
7099
|
+
}
|
|
7100
|
+
const pr = input.prUrl ? parsePrUrl(input.prUrl) : null;
|
|
7101
|
+
if (!pr) return { source: "none", reason: "\u6B64\u5361\u6C92\u6709 PR\uFF0C\u4E14 base \u4E2D\u627E\u4E0D\u5230\u9019\u500B commit\u3002" };
|
|
7102
|
+
return readGithubCommit(pr, input.sha, input.runGh ?? defaultGhRunner);
|
|
7103
|
+
}
|
|
7104
|
+
async function getDoneCommitFile(projectPath, baseBranch, sha, filePath) {
|
|
7105
|
+
const full = await resolveCommitInBase(projectPath, baseBranch, sha);
|
|
7106
|
+
if (!full) return null;
|
|
7107
|
+
const entry = (await collectCommitEntries(projectPath, full)).find((e) => e.path === filePath);
|
|
7108
|
+
if (!entry) return null;
|
|
7109
|
+
return readEntryFile(projectPath, await firstParent(projectPath, full), full, entry);
|
|
7110
|
+
}
|
|
7111
|
+
|
|
7112
|
+
// packages/core/src/board-cli.ts
|
|
7113
|
+
import fs18 from "fs";
|
|
6875
7114
|
import path20 from "path";
|
|
6876
7115
|
import { pathToFileURL } from "url";
|
|
6877
7116
|
async function boardCliLaunchInfo() {
|
|
6878
7117
|
const storeDir = path20.dirname(getStorePath());
|
|
6879
7118
|
const entry = getPlatform().cliEntry?.();
|
|
6880
|
-
if (entry &&
|
|
7119
|
+
if (entry && fs18.existsSync(entry)) return { storeDir, cliPath: entry };
|
|
6881
7120
|
const root = getPlatform().sourceRoot();
|
|
6882
7121
|
if (!root) return { storeDir };
|
|
6883
7122
|
const cliPath = path20.join(root, "scripts", "vibeflow.mjs");
|
|
6884
7123
|
const loaderPath = path20.join(root, "test", "support", "register.mjs");
|
|
6885
|
-
if (!
|
|
7124
|
+
if (!fs18.existsSync(cliPath) || !fs18.existsSync(loaderPath)) return { storeDir };
|
|
6886
7125
|
return { storeDir, cliPath, loaderPath: pathToFileURL(loaderPath).href };
|
|
6887
7126
|
}
|
|
6888
7127
|
|
|
6889
7128
|
// packages/core/src/decisions.ts
|
|
6890
|
-
import
|
|
7129
|
+
import fs19 from "fs";
|
|
6891
7130
|
import path21 from "path";
|
|
6892
7131
|
var DECISIONS_FILE_SUFFIX = ".DECISIONS.md";
|
|
6893
7132
|
function decisionsKey(worktreePath, branch) {
|
|
@@ -6898,95 +7137,9 @@ function decisionsPath(workspacePath, key) {
|
|
|
6898
7137
|
}
|
|
6899
7138
|
function deleteDecisions(workspacePath, key) {
|
|
6900
7139
|
try {
|
|
6901
|
-
|
|
6902
|
-
} catch {
|
|
6903
|
-
}
|
|
6904
|
-
}
|
|
6905
|
-
|
|
6906
|
-
// packages/core/src/specs.ts
|
|
6907
|
-
import fs19 from "fs";
|
|
6908
|
-
import path22 from "path";
|
|
6909
|
-
var SPEC_FILE_NAME = "spec.md";
|
|
6910
|
-
var MAX_SPEC_BYTES = 256 * 1024;
|
|
6911
|
-
function isSpecPath(p) {
|
|
6912
|
-
return path22.posix.basename(p) === SPEC_FILE_NAME;
|
|
6913
|
-
}
|
|
6914
|
-
function clip2(buf) {
|
|
6915
|
-
return {
|
|
6916
|
-
markdown: buf.subarray(0, MAX_SPEC_BYTES).toString("utf8"),
|
|
6917
|
-
...buf.byteLength > MAX_SPEC_BYTES ? { truncated: true } : {}
|
|
6918
|
-
};
|
|
6919
|
-
}
|
|
6920
|
-
async function readWorktreeSpecs(worktreePath, baseBranch) {
|
|
6921
|
-
const baseRef = await resolveBaseRef(worktreePath, baseBranch);
|
|
6922
|
-
const entries = await collectDiffEntries(worktreePath, baseRef);
|
|
6923
|
-
const specs = [];
|
|
6924
|
-
for (const entry of entries) {
|
|
6925
|
-
if (entry.status === "D" || !isSpecPath(entry.path)) continue;
|
|
6926
|
-
try {
|
|
6927
|
-
const full = path22.join(worktreePath, entry.path);
|
|
6928
|
-
const stat = fs19.statSync(full);
|
|
6929
|
-
if (!stat.isFile()) continue;
|
|
6930
|
-
specs.push({ path: entry.path, ...clip2(fs19.readFileSync(full)), updatedAt: stat.mtimeMs });
|
|
6931
|
-
} catch {
|
|
6932
|
-
}
|
|
6933
|
-
}
|
|
6934
|
-
return specs.sort((a, b) => a.path.localeCompare(b.path));
|
|
6935
|
-
}
|
|
6936
|
-
async function readBranchSpecs(projectPath, branch, baseBranch, changedPaths, launchedAt) {
|
|
6937
|
-
for (const ref of [`refs/heads/${branch}`, `refs/remotes/origin/${branch}`]) {
|
|
6938
|
-
if (!await refExists(projectPath, ref)) continue;
|
|
6939
|
-
const paths = changedPaths ?? await diffNames(projectPath, `${await resolveBaseRef(projectPath, baseBranch)}...${ref}`);
|
|
6940
|
-
const specs = await readSpecsAt(projectPath, ref, paths);
|
|
6941
|
-
if (specs.length > 0) return specs;
|
|
6942
|
-
}
|
|
6943
|
-
const merge = await findPullRequestMerge(projectPath, branch, baseBranch, launchedAt);
|
|
6944
|
-
if (!merge) return [];
|
|
6945
|
-
return readSpecsAt(projectPath, `${merge}^2`, await diffNames(projectPath, `${merge}^1`, merge));
|
|
6946
|
-
}
|
|
6947
|
-
async function refExists(cwd, ref) {
|
|
6948
|
-
try {
|
|
6949
|
-
await git(cwd, ["rev-parse", "--verify", "--quiet", ref]);
|
|
6950
|
-
return true;
|
|
7140
|
+
fs19.rmSync(decisionsPath(workspacePath, key), { force: true });
|
|
6951
7141
|
} catch {
|
|
6952
|
-
return false;
|
|
6953
|
-
}
|
|
6954
|
-
}
|
|
6955
|
-
async function diffNames(cwd, ...range) {
|
|
6956
|
-
const names = await git(cwd, ["diff", "--name-only", "--diff-filter=d", ...range]).catch(() => "");
|
|
6957
|
-
return names.split("\n").map((l) => l.trim());
|
|
6958
|
-
}
|
|
6959
|
-
async function findPullRequestMerge(cwd, branch, baseBranch, launchedAt) {
|
|
6960
|
-
const baseRef = await resolveBaseRef(cwd, baseBranch);
|
|
6961
|
-
const log = await git(cwd, [
|
|
6962
|
-
"log",
|
|
6963
|
-
"--merges",
|
|
6964
|
-
"--first-parent",
|
|
6965
|
-
"--format=%H %s",
|
|
6966
|
-
...launchedAt ? [`--since=${new Date(launchedAt).toISOString()}`] : [],
|
|
6967
|
-
baseRef
|
|
6968
|
-
]).catch(() => "");
|
|
6969
|
-
for (const line of log.split("\n")) {
|
|
6970
|
-
const match = /^(\S+) Merge pull request #\d+ from [^/\s]+\/(\S+)$/.exec(line.trim());
|
|
6971
|
-
if (match && match[2] === branch) return match[1];
|
|
6972
|
-
}
|
|
6973
|
-
return null;
|
|
6974
|
-
}
|
|
6975
|
-
async function readSpecsAt(cwd, ref, paths) {
|
|
6976
|
-
const specs = [];
|
|
6977
|
-
for (const p of paths.filter(isSpecPath)) {
|
|
6978
|
-
try {
|
|
6979
|
-
const content = await git(cwd, ["show", `${ref}:${p}`]);
|
|
6980
|
-
const ct = await git(cwd, ["log", "-1", "--format=%ct", ref, "--", p]);
|
|
6981
|
-
specs.push({
|
|
6982
|
-
path: p,
|
|
6983
|
-
...clip2(Buffer.from(content, "utf8")),
|
|
6984
|
-
...ct ? { updatedAt: Number(ct) * 1e3 } : {}
|
|
6985
|
-
});
|
|
6986
|
-
} catch {
|
|
6987
|
-
}
|
|
6988
7142
|
}
|
|
6989
|
-
return specs.sort((a, b) => a.path.localeCompare(b.path));
|
|
6990
7143
|
}
|
|
6991
7144
|
|
|
6992
7145
|
// packages/core/src/chat-session.ts
|
|
@@ -7281,13 +7434,13 @@ init_progress();
|
|
|
7281
7434
|
init_launch();
|
|
7282
7435
|
import fs20 from "fs";
|
|
7283
7436
|
import os8 from "os";
|
|
7284
|
-
import
|
|
7437
|
+
import path22 from "path";
|
|
7285
7438
|
var SINCE_SLACK_MS = 5e3;
|
|
7286
7439
|
function claudeProjectDir(home, cwd) {
|
|
7287
|
-
return
|
|
7440
|
+
return path22.join(home, ".claude", "projects", cwd.replace(/[^a-zA-Z0-9]/g, "-"));
|
|
7288
7441
|
}
|
|
7289
7442
|
function pathAliases(p) {
|
|
7290
|
-
const resolved =
|
|
7443
|
+
const resolved = path22.resolve(p);
|
|
7291
7444
|
try {
|
|
7292
7445
|
const real = fs20.realpathSync(resolved);
|
|
7293
7446
|
return real === resolved ? [resolved] : [resolved, real];
|
|
@@ -7305,7 +7458,7 @@ function samePath(a, b) {
|
|
|
7305
7458
|
}
|
|
7306
7459
|
function listFiles(dir, test) {
|
|
7307
7460
|
try {
|
|
7308
|
-
return fs20.readdirSync(dir).filter(test).map((name) =>
|
|
7461
|
+
return fs20.readdirSync(dir).filter(test).map((name) => path22.join(dir, name));
|
|
7309
7462
|
} catch {
|
|
7310
7463
|
return [];
|
|
7311
7464
|
}
|
|
@@ -7375,14 +7528,14 @@ function codexDayDirs(sessionsRoot, since) {
|
|
|
7375
7528
|
const cur = new Date(start.getFullYear(), start.getMonth(), start.getDate());
|
|
7376
7529
|
while (cur <= end) {
|
|
7377
7530
|
const pad = (n) => String(n).padStart(2, "0");
|
|
7378
|
-
days.push(
|
|
7531
|
+
days.push(path22.join(sessionsRoot, String(cur.getFullYear()), pad(cur.getMonth() + 1), pad(cur.getDate())));
|
|
7379
7532
|
cur.setDate(cur.getDate() + 1);
|
|
7380
7533
|
}
|
|
7381
7534
|
return days;
|
|
7382
7535
|
}
|
|
7383
7536
|
function createProgressTracker(opts) {
|
|
7384
7537
|
const home = opts.homeDir ?? os8.homedir();
|
|
7385
|
-
const codexHomes = opts.codexHomes ?? (() => [
|
|
7538
|
+
const codexHomes = opts.codexHomes ?? (() => [path22.join(home, ".codex")]);
|
|
7386
7539
|
const pollMs = opts.pollMs ?? 2e3;
|
|
7387
7540
|
const entries = /* @__PURE__ */ new Map();
|
|
7388
7541
|
const belongsToRun = (target, startedAt) => target.since == null || startedAt != null && startedAt >= target.since - SINCE_SLACK_MS;
|
|
@@ -7391,7 +7544,7 @@ function createProgressTracker(opts) {
|
|
|
7391
7544
|
const dirs = pathAliases(target.worktreePath).map((p) => claudeProjectDir(home, p));
|
|
7392
7545
|
for (const file of dirs.flatMap((dir) => listFiles(dir, (n) => n.endsWith(".jsonl")))) {
|
|
7393
7546
|
if (entry.claude.has(file) || entry.rejected.has(file)) continue;
|
|
7394
|
-
const session =
|
|
7547
|
+
const session = path22.basename(file, ".jsonl");
|
|
7395
7548
|
if (session !== target.sessionId) {
|
|
7396
7549
|
const head = firstLine(file);
|
|
7397
7550
|
if (head == null) continue;
|
|
@@ -7404,8 +7557,8 @@ function createProgressTracker(opts) {
|
|
|
7404
7557
|
entry.claude.set(file, newCursor(initialClaudeState()));
|
|
7405
7558
|
}
|
|
7406
7559
|
for (const file of Array.from(entry.claude.keys())) {
|
|
7407
|
-
if (file.includes(`${
|
|
7408
|
-
const sub =
|
|
7560
|
+
if (file.includes(`${path22.sep}subagents${path22.sep}`)) continue;
|
|
7561
|
+
const sub = path22.join(file.slice(0, -".jsonl".length), "subagents");
|
|
7409
7562
|
for (const f of listFiles(sub, (n) => n.endsWith(".jsonl"))) {
|
|
7410
7563
|
if (!entry.claude.has(f)) entry.claude.set(f, newCursor(initialClaudeState()));
|
|
7411
7564
|
}
|
|
@@ -7414,7 +7567,7 @@ function createProgressTracker(opts) {
|
|
|
7414
7567
|
function discoverCodex(entry) {
|
|
7415
7568
|
const { target } = entry;
|
|
7416
7569
|
for (const codexHome of codexHomes()) {
|
|
7417
|
-
for (const day of codexDayDirs(
|
|
7570
|
+
for (const day of codexDayDirs(path22.join(codexHome, "sessions"), target.since)) {
|
|
7418
7571
|
for (const file of listFiles(day, (n) => n.startsWith("rollout-") && n.endsWith(".jsonl"))) {
|
|
7419
7572
|
if (entry.codex.has(file) || entry.rejected.has(file)) continue;
|
|
7420
7573
|
const head = firstLine(file);
|
|
@@ -7431,7 +7584,7 @@ function createProgressTracker(opts) {
|
|
|
7431
7584
|
}
|
|
7432
7585
|
}
|
|
7433
7586
|
function drainHooks(entry) {
|
|
7434
|
-
const dir =
|
|
7587
|
+
const dir = path22.join(entry.target.worktreePath, PROGRESS_EVENTS_DIR);
|
|
7435
7588
|
for (const file of listFiles(dir, (n) => n.endsWith(".json")).sort()) {
|
|
7436
7589
|
try {
|
|
7437
7590
|
const at = fs20.statSync(file).mtimeMs;
|
|
@@ -7455,8 +7608,8 @@ function createProgressTracker(opts) {
|
|
|
7455
7608
|
if (target.agent === "claude") {
|
|
7456
7609
|
for (const [file, cursor] of entry.claude) {
|
|
7457
7610
|
runUsage = addUsage(runUsage, claudeUsageTotal(cursor.state));
|
|
7458
|
-
if (file.includes(`${
|
|
7459
|
-
const isExecutor =
|
|
7611
|
+
if (file.includes(`${path22.sep}subagents${path22.sep}`)) continue;
|
|
7612
|
+
const isExecutor = path22.basename(file, ".jsonl") === target.sessionId;
|
|
7460
7613
|
const s = cursor.state;
|
|
7461
7614
|
if (isExecutor || !target.sessionId && (!primary || (s.startedAt ?? 0) > (primary.startedAt ?? 0))) {
|
|
7462
7615
|
primary = { todos: s.todos, contextTokens: s.contextTokens, activity: s.activity, startedAt: s.startedAt };
|
|
@@ -7535,7 +7688,7 @@ function createProgressTracker(opts) {
|
|
|
7535
7688
|
};
|
|
7536
7689
|
entry.timer.unref?.();
|
|
7537
7690
|
entries.set(target.taskId, entry);
|
|
7538
|
-
const eventsDir =
|
|
7691
|
+
const eventsDir = path22.join(target.worktreePath, PROGRESS_EVENTS_DIR);
|
|
7539
7692
|
try {
|
|
7540
7693
|
fs20.mkdirSync(eventsDir, { recursive: true });
|
|
7541
7694
|
entry.watcher = fs20.watch(eventsDir, () => {
|
|
@@ -7769,6 +7922,17 @@ function coded2(code2, message2) {
|
|
|
7769
7922
|
function invalid(message2) {
|
|
7770
7923
|
throw new InvalidRequestError(message2);
|
|
7771
7924
|
}
|
|
7925
|
+
function commitRef(value) {
|
|
7926
|
+
if (value === WORKING_CHANGES || isCommitSha(value)) return value;
|
|
7927
|
+
invalid('ref must be a commit sha or "working"');
|
|
7928
|
+
}
|
|
7929
|
+
function outcomeCommit(task, value) {
|
|
7930
|
+
if (isMasterTask(task)) invalid("a master card has no commits");
|
|
7931
|
+
if (!isCommitSha(value) || !task.outcome?.commits.some((c) => c.sha === value)) {
|
|
7932
|
+
invalid("sha is not one of this card's commits");
|
|
7933
|
+
}
|
|
7934
|
+
return value;
|
|
7935
|
+
}
|
|
7772
7936
|
function str(value, name) {
|
|
7773
7937
|
if (typeof value !== "string") invalid(`${name} must be a string`);
|
|
7774
7938
|
return value;
|
|
@@ -7829,7 +7993,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7829
7993
|
const home = homeDir ?? os9.homedir();
|
|
7830
7994
|
const progress = createProgressTracker({
|
|
7831
7995
|
homeDir: home,
|
|
7832
|
-
codexHomes: () => [
|
|
7996
|
+
codexHomes: () => [path23.join(home, ".codex"), ...libraryCodexHome ? [libraryCodexHome] : []],
|
|
7833
7997
|
onUpdate: (taskId, value) => {
|
|
7834
7998
|
bus.emit("progress:update", { taskId, progress: value });
|
|
7835
7999
|
notifier.activity(taskId, value.activity);
|
|
@@ -8008,13 +8172,13 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
8008
8172
|
}
|
|
8009
8173
|
function claudeSessionFile(cwd, sessionId) {
|
|
8010
8174
|
const munged = cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
8011
|
-
return
|
|
8175
|
+
return path23.join(os9.homedir(), ".claude", "projects", munged, `${sessionId}.jsonl`);
|
|
8012
8176
|
}
|
|
8013
8177
|
async function removeTaskWorktree(task) {
|
|
8014
8178
|
if (!task.projectPath || !task.worktreePath) return;
|
|
8015
8179
|
const branch = task.branch || fallbackBranchName(task.id);
|
|
8016
8180
|
await removeWorktree(task.projectPath, task.worktreePath);
|
|
8017
|
-
deleteArtifacts(task.workspacePath ??
|
|
8181
|
+
deleteArtifacts(task.workspacePath ?? path23.dirname(task.worktreePath), task.worktreePath);
|
|
8018
8182
|
await deleteBranch(task.projectPath, branch);
|
|
8019
8183
|
}
|
|
8020
8184
|
function columnOf(taskId) {
|
|
@@ -8258,7 +8422,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
8258
8422
|
"projects:listRecent": () => listRecentProjects(getStore()),
|
|
8259
8423
|
// `vibeflow open <path>` while a host runs: only the host writes the store.
|
|
8260
8424
|
"projects:record": (projectPath) => {
|
|
8261
|
-
const p =
|
|
8425
|
+
const p = path23.resolve(str(projectPath, "projectPath"));
|
|
8262
8426
|
if (!fs21.existsSync(p) || !fs21.statSync(p).isDirectory()) invalid(`not a directory: ${p}`);
|
|
8263
8427
|
recordRecentProject(getStore(), p);
|
|
8264
8428
|
return listRecentProjects(getStore());
|
|
@@ -8332,7 +8496,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
8332
8496
|
if (!task.baseBranch) throw new Error("\u4EFB\u52D9\u6C92\u6709\u8A18\u9304 base branch\uFF0C\u7121\u6CD5\u9084\u539F worktree");
|
|
8333
8497
|
await teardownTask(task.id);
|
|
8334
8498
|
await resetWorktreeToBase(task.worktreePath, task.baseBranch);
|
|
8335
|
-
const workspacePath = task.workspacePath ??
|
|
8499
|
+
const workspacePath = task.workspacePath ?? path23.dirname(task.worktreePath);
|
|
8336
8500
|
deleteArtifacts(workspacePath, task.worktreePath);
|
|
8337
8501
|
deleteDecisions(workspacePath, decisionsKey(task.worktreePath, task.branch));
|
|
8338
8502
|
resetSubAgents(task.worktreePath);
|
|
@@ -8384,7 +8548,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
8384
8548
|
}
|
|
8385
8549
|
const info = await getGitInfo(nextProject);
|
|
8386
8550
|
if (!info.isRepo) throw new Error("\u76EE\u6A19\u8CC7\u6599\u593E\u4E0D\u662F git repository");
|
|
8387
|
-
const projectName =
|
|
8551
|
+
const projectName = path23.basename(nextProject);
|
|
8388
8552
|
const workspacePath = projectWorkstationPath(resolveWorkstationPath(getSettings()), projectName);
|
|
8389
8553
|
await teardownTask(existing.id);
|
|
8390
8554
|
await removeTaskWorktree(existing);
|
|
@@ -8496,10 +8660,10 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
8496
8660
|
} else {
|
|
8497
8661
|
cwd = os9.homedir();
|
|
8498
8662
|
}
|
|
8499
|
-
if (!
|
|
8663
|
+
if (!path23.isAbsolute(cwd) || !fs21.existsSync(cwd) || !fs21.statSync(cwd).isDirectory()) {
|
|
8500
8664
|
invalid("terminal directory must be an existing absolute directory");
|
|
8501
8665
|
}
|
|
8502
|
-
const title = (typeof p.title === "string" ? p.title.trim() : "") || saved?.title || (projectPath ?
|
|
8666
|
+
const title = (typeof p.title === "string" ? p.title.trim() : "") || saved?.title || (projectPath ? path23.basename(projectPath) : "~");
|
|
8503
8667
|
saveTerminal({
|
|
8504
8668
|
sessionKey: key,
|
|
8505
8669
|
title,
|
|
@@ -8606,6 +8770,45 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
8606
8770
|
if (!worktree) return null;
|
|
8607
8771
|
return getWorktreeDiffFile(worktree, task.baseBranch ?? "HEAD", str(filePath, "filePath"));
|
|
8608
8772
|
},
|
|
8773
|
+
/** A running card's commits (`base..HEAD`) plus a summary of what is uncommitted. Local only. */
|
|
8774
|
+
"git:listCommits": (taskId) => {
|
|
8775
|
+
const task = requireTask(taskId);
|
|
8776
|
+
const worktree = gitWorktree(task);
|
|
8777
|
+
if (!worktree) return null;
|
|
8778
|
+
return getBranchCommits(worktree, task.baseBranch ?? "HEAD");
|
|
8779
|
+
},
|
|
8780
|
+
"git:getCommitEntries": (taskId, ref) => {
|
|
8781
|
+
const task = requireTask(taskId);
|
|
8782
|
+
const worktree = gitWorktree(task);
|
|
8783
|
+
if (!worktree) return null;
|
|
8784
|
+
return getCommitEntries(worktree, task.baseBranch ?? "HEAD", commitRef(ref));
|
|
8785
|
+
},
|
|
8786
|
+
"git:getCommitFile": (taskId, ref, filePath) => {
|
|
8787
|
+
const task = requireTask(taskId);
|
|
8788
|
+
const worktree = gitWorktree(task);
|
|
8789
|
+
if (!worktree) return null;
|
|
8790
|
+
return getCommitFile(worktree, task.baseBranch ?? "HEAD", commitRef(ref), str(filePath, "filePath"));
|
|
8791
|
+
},
|
|
8792
|
+
/**
|
|
8793
|
+
* One commit of a finished card: from the project's base, else from its PR
|
|
8794
|
+
* through `gh`. Only commits the card recorded in its outcome are read.
|
|
8795
|
+
*/
|
|
8796
|
+
"git:getDoneCommitDiff": (taskId, sha) => {
|
|
8797
|
+
const task = requireTask(taskId);
|
|
8798
|
+
const commit = outcomeCommit(task, sha);
|
|
8799
|
+
return getDoneCommitDiff({
|
|
8800
|
+
projectPath: task.projectPath || void 0,
|
|
8801
|
+
baseBranch: task.baseBranch ?? "main",
|
|
8802
|
+
sha: commit,
|
|
8803
|
+
prUrl: task.outcome?.pr?.url
|
|
8804
|
+
});
|
|
8805
|
+
},
|
|
8806
|
+
"git:getDoneCommitFile": (taskId, sha, filePath) => {
|
|
8807
|
+
const task = requireTask(taskId);
|
|
8808
|
+
const commit = outcomeCommit(task, sha);
|
|
8809
|
+
if (!task.projectPath) return null;
|
|
8810
|
+
return getDoneCommitFile(task.projectPath, task.baseBranch ?? "main", commit, str(filePath, "filePath"));
|
|
8811
|
+
},
|
|
8609
8812
|
"task:listArtifacts": (taskId) => {
|
|
8610
8813
|
const task = requireTask(taskId);
|
|
8611
8814
|
if (!task.worktreePath || !task.workspacePath) return [];
|
|
@@ -8627,16 +8830,6 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
8627
8830
|
if (!fs21.existsSync(dir)) return "artifacts directory does not exist yet";
|
|
8628
8831
|
return getPlatform().openPath(dir);
|
|
8629
8832
|
},
|
|
8630
|
-
"task:getSpecs": async (taskId) => {
|
|
8631
|
-
const task = requireTask(taskId);
|
|
8632
|
-
const base2 = task.baseBranch ?? "main";
|
|
8633
|
-
if (isMasterTask(task)) return [];
|
|
8634
|
-
if (task.worktreePath) return readWorktreeSpecs(task.worktreePath, base2);
|
|
8635
|
-
const since = task.provisionedAt ?? task.launchedAt ?? (task.pushed !== void 0 ? task.createdAt : void 0);
|
|
8636
|
-
if (!task.projectPath || !since) return [];
|
|
8637
|
-
const changed = task.outcome?.files.filter((f) => f.status !== "D").map((f) => f.path);
|
|
8638
|
-
return readBranchSpecs(task.projectPath, task.branch, base2, changed, since);
|
|
8639
|
-
},
|
|
8640
8833
|
"board:getCliLaunchInfo": () => boardCliLaunchInfo(),
|
|
8641
8834
|
"library:list": async () => listLibrary(await libraryRoot(), builtinSkillsDir()),
|
|
8642
8835
|
// The source path was picked by the user (native picker or typed path).
|
|
@@ -8821,9 +9014,9 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
8821
9014
|
// Watch the containing directory, not the file: JsonStore renames a temp
|
|
8822
9015
|
// file over the target and so replaces the inode on every save.
|
|
8823
9016
|
watchStore() {
|
|
8824
|
-
const file =
|
|
9017
|
+
const file = path23.basename(getStorePath());
|
|
8825
9018
|
let debounce = null;
|
|
8826
|
-
storeWatcher = fs21.watch(
|
|
9019
|
+
storeWatcher = fs21.watch(path23.dirname(getStorePath()), (_event, filename) => {
|
|
8827
9020
|
if (filename !== file) return;
|
|
8828
9021
|
if (debounce) clearTimeout(debounce);
|
|
8829
9022
|
debounce = setTimeout(() => {
|
|
@@ -8862,7 +9055,7 @@ function createSessionBackend(sink, choice) {
|
|
|
8862
9055
|
// packages/core/src/web-server.ts
|
|
8863
9056
|
import fs22 from "fs";
|
|
8864
9057
|
import http from "http";
|
|
8865
|
-
import
|
|
9058
|
+
import path24 from "path";
|
|
8866
9059
|
import { timingSafeEqual } from "crypto";
|
|
8867
9060
|
import { WebSocketServer } from "ws";
|
|
8868
9061
|
var TOKEN_COOKIE = "vf_token";
|
|
@@ -8917,12 +9110,12 @@ function resolveStatic(root, urlPath) {
|
|
|
8917
9110
|
return null;
|
|
8918
9111
|
}
|
|
8919
9112
|
if (decoded.includes("\0")) return null;
|
|
8920
|
-
const rel =
|
|
8921
|
-
const base2 =
|
|
8922
|
-
const candidates = [rel,
|
|
9113
|
+
const rel = path24.posix.normalize(decoded).replace(/^\/+/, "");
|
|
9114
|
+
const base2 = path24.resolve(root);
|
|
9115
|
+
const candidates = [rel, path24.posix.join(rel, "index.html"), `${rel}.html`];
|
|
8923
9116
|
for (const c of candidates) {
|
|
8924
|
-
const full =
|
|
8925
|
-
if (full !== base2 && !full.startsWith(base2 +
|
|
9117
|
+
const full = path24.resolve(base2, c);
|
|
9118
|
+
if (full !== base2 && !full.startsWith(base2 + path24.sep)) return null;
|
|
8926
9119
|
try {
|
|
8927
9120
|
if (fs22.statSync(full).isFile()) return full;
|
|
8928
9121
|
} catch {
|
|
@@ -8985,7 +9178,7 @@ async function startWebServer(options) {
|
|
|
8985
9178
|
send(res, 404, "Not found");
|
|
8986
9179
|
return;
|
|
8987
9180
|
}
|
|
8988
|
-
const ext =
|
|
9181
|
+
const ext = path24.extname(file).toLowerCase();
|
|
8989
9182
|
const immutable = url.pathname.startsWith("/_next/static/");
|
|
8990
9183
|
res.writeHead(200, {
|
|
8991
9184
|
"Content-Type": CONTENT_TYPES[ext] ?? "application/octet-stream",
|
|
@@ -9098,7 +9291,7 @@ Content-Length: 0\r
|
|
|
9098
9291
|
|
|
9099
9292
|
// packages/cli/src/update-command.ts
|
|
9100
9293
|
import fs23 from "node:fs";
|
|
9101
|
-
import
|
|
9294
|
+
import path25 from "node:path";
|
|
9102
9295
|
import { spawnSync } from "node:child_process";
|
|
9103
9296
|
function npmRunner(args, inherit) {
|
|
9104
9297
|
const spawnOpts = {
|
|
@@ -9110,7 +9303,7 @@ function npmRunner(args, inherit) {
|
|
|
9110
9303
|
}
|
|
9111
9304
|
function packageName(packageRoot) {
|
|
9112
9305
|
try {
|
|
9113
|
-
const pkg = JSON.parse(fs23.readFileSync(
|
|
9306
|
+
const pkg = JSON.parse(fs23.readFileSync(path25.join(packageRoot, "package.json"), "utf8"));
|
|
9114
9307
|
if (typeof pkg.name !== "string") return null;
|
|
9115
9308
|
return /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i.test(pkg.name) ? pkg.name : null;
|
|
9116
9309
|
} catch {
|
|
@@ -9125,7 +9318,7 @@ function runUpdate(options) {
|
|
|
9125
9318
|
error("vibeflow update \u53EA\u9069\u7528\u65BC\u5168\u57DF npm \u5B89\u88DD\uFF1B\u76EE\u524D\u662F\u539F\u59CB\u78BC\u7248\u672C\u3002");
|
|
9126
9319
|
return 1;
|
|
9127
9320
|
}
|
|
9128
|
-
const packageRoot =
|
|
9321
|
+
const packageRoot = path25.dirname(path25.dirname(options.cliEntry));
|
|
9129
9322
|
const name = packageName(packageRoot);
|
|
9130
9323
|
if (!name) {
|
|
9131
9324
|
error("\u7121\u6CD5\u8FA8\u8B58\u76EE\u524D VibeFlow \u7684 npm \u5957\u4EF6\u540D\u7A31\uFF0C\u5DF2\u53D6\u6D88\u66F4\u65B0\u3002");
|
|
@@ -9137,7 +9330,7 @@ function runUpdate(options) {
|
|
|
9137
9330
|
return 1;
|
|
9138
9331
|
}
|
|
9139
9332
|
try {
|
|
9140
|
-
const globalPackage =
|
|
9333
|
+
const globalPackage = path25.join(String(root.stdout).trim(), ...name.split("/"));
|
|
9141
9334
|
if (fs23.lstatSync(globalPackage).isSymbolicLink() || fs23.realpathSync(globalPackage) !== fs23.realpathSync(packageRoot)) {
|
|
9142
9335
|
error("vibeflow update \u53EA\u9069\u7528\u65BC\u5168\u57DF npm \u5B89\u88DD\uFF1B\u76EE\u524D\u57F7\u884C\u7684\u5957\u4EF6\u4F86\u81EA\u5176\u4ED6\u4F4D\u7F6E\u3002");
|
|
9143
9336
|
return 1;
|
|
@@ -9284,7 +9477,7 @@ async function openUpdateTerminal(platform = process.platform, run3 = launch) {
|
|
|
9284
9477
|
|
|
9285
9478
|
// packages/cli/src/self-update.ts
|
|
9286
9479
|
import fs24 from "node:fs";
|
|
9287
|
-
import
|
|
9480
|
+
import path26 from "node:path";
|
|
9288
9481
|
import { execFile as execFile10 } from "node:child_process";
|
|
9289
9482
|
import { promisify as promisify7 } from "node:util";
|
|
9290
9483
|
var execFileAsync2 = promisify7(execFile10);
|
|
@@ -9293,7 +9486,7 @@ var PROBE_RETRY_MS = 3e4;
|
|
|
9293
9486
|
var HOST_TOKEN_ENV = "VIBEFLOW_HOST_TOKEN";
|
|
9294
9487
|
function readInstalledVersion(packageRoot) {
|
|
9295
9488
|
try {
|
|
9296
|
-
const pkg = JSON.parse(fs24.readFileSync(
|
|
9489
|
+
const pkg = JSON.parse(fs24.readFileSync(path26.join(packageRoot, "package.json"), "utf8"));
|
|
9297
9490
|
return typeof pkg.version === "string" ? pkg.version : null;
|
|
9298
9491
|
} catch {
|
|
9299
9492
|
return null;
|
|
@@ -9389,7 +9582,7 @@ async function startHost(options) {
|
|
|
9389
9582
|
const core = createCore({ sessions, bus, version: options.version });
|
|
9390
9583
|
let updateTimer = null;
|
|
9391
9584
|
let installTimer = null;
|
|
9392
|
-
const packageRoot = options.cliEntry ?
|
|
9585
|
+
const packageRoot = options.cliEntry ? path27.dirname(path27.dirname(options.cliEntry)) : null;
|
|
9393
9586
|
const updates = createUpdateMonitor({
|
|
9394
9587
|
packageName: options.sourceRoot || !packageRoot ? null : packageName(packageRoot),
|
|
9395
9588
|
currentVersion: options.version,
|
|
@@ -9477,12 +9670,12 @@ function loginUrl(lock, pathname = "/home/") {
|
|
|
9477
9670
|
return `http://127.0.0.1:${lock.port}${pathname}?token=${encodeURIComponent(lock.token)}`;
|
|
9478
9671
|
}
|
|
9479
9672
|
function isWebDir(dir) {
|
|
9480
|
-
return fs25.existsSync(
|
|
9673
|
+
return fs25.existsSync(path27.join(dir, "home", "index.html"));
|
|
9481
9674
|
}
|
|
9482
9675
|
|
|
9483
9676
|
// packages/cli/src/doctor.ts
|
|
9484
9677
|
import fs26 from "fs";
|
|
9485
|
-
import
|
|
9678
|
+
import path28 from "path";
|
|
9486
9679
|
import { execFile as execFile11 } from "child_process";
|
|
9487
9680
|
import { promisify as promisify8 } from "util";
|
|
9488
9681
|
init_env();
|
|
@@ -9623,7 +9816,7 @@ async function runDoctor(options) {
|
|
|
9623
9816
|
}
|
|
9624
9817
|
try {
|
|
9625
9818
|
fs26.mkdirSync(options.userDataDir, { recursive: true });
|
|
9626
|
-
const probe =
|
|
9819
|
+
const probe = path28.join(options.userDataDir, `.doctor-${process.pid}`);
|
|
9627
9820
|
fs26.writeFileSync(probe, "");
|
|
9628
9821
|
fs26.rmSync(probe);
|
|
9629
9822
|
checks.push({ id: "data", name: "\u8CC7\u6599\u76EE\u9304", level: "ok", detail: options.userDataDir });
|
|
@@ -9680,20 +9873,20 @@ Options:
|
|
|
9680
9873
|
`.trim();
|
|
9681
9874
|
function detectLayout() {
|
|
9682
9875
|
const file = fileURLToPath2(import.meta.url);
|
|
9683
|
-
const here =
|
|
9684
|
-
const bundledWeb =
|
|
9685
|
-
if (isWebDir(bundledWeb) ||
|
|
9876
|
+
const here = path31.dirname(file);
|
|
9877
|
+
const bundledWeb = path31.join(here, "web");
|
|
9878
|
+
if (isWebDir(bundledWeb) || path31.basename(here) === "dist") {
|
|
9686
9879
|
return {
|
|
9687
|
-
version: readVersion(
|
|
9880
|
+
version: readVersion(path31.join(here, "..", "package.json")),
|
|
9688
9881
|
webDir: isWebDir(bundledWeb) ? bundledWeb : null,
|
|
9689
9882
|
sourceRoot: null,
|
|
9690
9883
|
cliEntry: file
|
|
9691
9884
|
};
|
|
9692
9885
|
}
|
|
9693
|
-
const root =
|
|
9886
|
+
const root = path31.resolve(here, "..", "..", "..");
|
|
9694
9887
|
const override = process.env.VIBEFLOW_WEB_DIR;
|
|
9695
|
-
const webDir = override && isWebDir(override) ? override : isWebDir(
|
|
9696
|
-
return { version: readVersion(
|
|
9888
|
+
const webDir = override && isWebDir(override) ? override : isWebDir(path31.join(root, "app")) ? path31.join(root, "app") : null;
|
|
9889
|
+
return { version: readVersion(path31.join(root, "package.json")), webDir, sourceRoot: root, cliEntry: null };
|
|
9697
9890
|
}
|
|
9698
9891
|
function readVersion(pkgPath) {
|
|
9699
9892
|
try {
|
|
@@ -9935,7 +10128,7 @@ async function cmdOpen(values, target, layout, userDataDir) {
|
|
|
9935
10128
|
console.error("\u7528\u6CD5\uFF1Avibeflow open <path>");
|
|
9936
10129
|
return 1;
|
|
9937
10130
|
}
|
|
9938
|
-
const dir =
|
|
10131
|
+
const dir = path31.resolve(target);
|
|
9939
10132
|
if (!fs28.existsSync(dir) || !fs28.statSync(dir).isDirectory()) {
|
|
9940
10133
|
console.error(`\u4E0D\u662F\u8CC7\u6599\u593E\uFF1A${dir}`);
|
|
9941
10134
|
return 1;
|