@kw-yeh/vibeflow 4.11.51 → 4.11.54
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 +1 -1
- package/dist/builtin-skills/address-review/SKILL.md +121 -0
- package/dist/builtin-skills/address-review/scripts/pr-lib.mjs +142 -0
- package/dist/builtin-skills/address-review/scripts/review.mjs +123 -0
- package/dist/builtin-skills/pr-watch/SKILL.md +77 -0
- package/dist/builtin-skills/pr-watch/scripts/pr-lib.mjs +142 -0
- package/dist/builtin-skills/pr-watch/scripts/pr-watch.mjs +169 -0
- package/dist/vibeflow.mjs +171 -28
- package/dist/web/404/index.html +1 -1
- package/dist/web/404.html +1 -1
- package/dist/web/_next/static/chunks/832-2b8f91a735ed3cd5.js +9 -0
- package/dist/web/_next/static/chunks/pages/home-a1f82648d0008f6b.js +13 -0
- package/dist/web/_next/static/chunks/{webpack-1f79da4960e22d5d.js → webpack-d7cc7d90e557abc8.js} +1 -1
- package/dist/web/_next/static/css/650f4825184c406d.css +2 -0
- package/dist/web/_next/static/{fodR70zn2dJD1rhJm0sTb → f-KIgR-HyA9O87YmYdD4w}/_buildManifest.js +1 -1
- package/dist/web/home/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/_next/static/chunks/5547-fcd96dc40c69c4dd.js +0 -9
- package/dist/web/_next/static/chunks/pages/home-fc7c1bbdd55fc48b.js +0 -13
- package/dist/web/_next/static/css/bcbff99c95674f0f.css +0 -2
- /package/dist/web/_next/static/{fodR70zn2dJD1rhJm0sTb → f-KIgR-HyA9O87YmYdD4w}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Wait, silently, until a PR needs the agent: prints ONE JSON line and exits.
|
|
3
|
+
//
|
|
4
|
+
// node pr-watch.mjs [--pr N] [--interval 60] [--state FILE] [--since-now] [--max-wait SEC] [--once]
|
|
5
|
+
//
|
|
6
|
+
// exit 10 {"event":"comments",...} review items nobody answered and not reported before
|
|
7
|
+
// exit 11 {"event":"base",...} the base branch has commits the PR head lacks
|
|
8
|
+
// exit 0 {"event":"merged"|"closed",...}
|
|
9
|
+
// exit 3 {"event":"timeout"} --max-wait passed (or --once found nothing); run it again
|
|
10
|
+
// exit 2 {"event":"error",...} setup failed, or GitHub kept failing
|
|
11
|
+
import fs from 'node:fs'
|
|
12
|
+
import os from 'node:os'
|
|
13
|
+
import path from 'node:path'
|
|
14
|
+
import { pathToFileURL } from 'node:url'
|
|
15
|
+
import { fetchBaseStatus, fetchPr, itemKey, pendingItems, repoNwo, resolvePrNumber } from './pr-lib.mjs'
|
|
16
|
+
|
|
17
|
+
export const EXIT = { done: 0, error: 2, timeout: 3, comments: 10, base: 11 }
|
|
18
|
+
const MIN_INTERVAL = 20
|
|
19
|
+
const MAX_BACKOFF = 300
|
|
20
|
+
const MAX_FAILURES = 10
|
|
21
|
+
|
|
22
|
+
export function parseArgs(argv) {
|
|
23
|
+
const opts = { interval: 60, sinceNow: false, once: false }
|
|
24
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
25
|
+
const arg = argv[i]
|
|
26
|
+
const value = () => {
|
|
27
|
+
const v = argv[++i]
|
|
28
|
+
if (v === undefined) throw new Error(`${arg} needs a value`)
|
|
29
|
+
return v
|
|
30
|
+
}
|
|
31
|
+
if (arg === '--pr') opts.pr = value()
|
|
32
|
+
else if (arg === '--interval') opts.interval = Math.max(MIN_INTERVAL, Number(value()) || 60)
|
|
33
|
+
else if (arg === '--state') opts.state = value()
|
|
34
|
+
else if (arg === '--max-wait') opts.maxWait = Number(value())
|
|
35
|
+
else if (arg === '--since-now') opts.sinceNow = true
|
|
36
|
+
else if (arg === '--once') opts.once = true
|
|
37
|
+
else throw new Error(`unknown option ${arg}`)
|
|
38
|
+
}
|
|
39
|
+
return opts
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function defaultStatePath(nwo, number, env = process.env) {
|
|
43
|
+
const dir = env.VIBEFLOW_SCRATCH_DIR || os.tmpdir()
|
|
44
|
+
return path.join(dir, `pr-watch-${nwo.replace('/', '-')}-${number}.json`)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function readState(file) {
|
|
48
|
+
try {
|
|
49
|
+
const state = JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
50
|
+
return { seen: Array.isArray(state.seen) ? state.seen : [], baseOid: state.baseOid ?? null }
|
|
51
|
+
} catch {
|
|
52
|
+
return null
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function writeState(file, state) {
|
|
57
|
+
fs.mkdirSync(path.dirname(file), { recursive: true })
|
|
58
|
+
const tmp = `${file}.${process.pid}.tmp`
|
|
59
|
+
fs.writeFileSync(tmp, `${JSON.stringify(state)}\n`)
|
|
60
|
+
fs.renameSync(tmp, file)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* What one poll means, given what was already reported. A finished PR wins,
|
|
65
|
+
* then comments (answering them before a rebase keeps their line anchors
|
|
66
|
+
* meaningful), then a base branch the head has fallen behind. A base already
|
|
67
|
+
* reported at this commit is not reported again, so a rebase the agent could
|
|
68
|
+
* not finish does not wake it in a loop.
|
|
69
|
+
*/
|
|
70
|
+
export function decide(pr, base, state) {
|
|
71
|
+
if (pr.merged) return { event: { event: 'merged', pr: pr.number }, state }
|
|
72
|
+
if (pr.state === 'CLOSED') return { event: { event: 'closed', pr: pr.number }, state }
|
|
73
|
+
|
|
74
|
+
const seen = new Set(state.seen)
|
|
75
|
+
const fresh = pendingItems(pr).filter((item) => !seen.has(itemKey(item)))
|
|
76
|
+
if (fresh.length) {
|
|
77
|
+
const keys = fresh.map(itemKey)
|
|
78
|
+
return {
|
|
79
|
+
event: { event: 'comments', pr: pr.number, count: fresh.length, items: keys },
|
|
80
|
+
state: { ...state, seen: [...state.seen, ...keys] },
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (base && base.behindBy > 0 && base.oid !== state.baseOid) {
|
|
84
|
+
return {
|
|
85
|
+
event: { event: 'base', pr: pr.number, base: pr.baseRefName, sha: base.oid, behindBy: base.behindBy },
|
|
86
|
+
state: { ...state, baseOid: base.oid },
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return { event: null, state }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Mark everything already there as reported, for --since-now. */
|
|
93
|
+
export function baseline(pr, base) {
|
|
94
|
+
return { seen: pendingItems(pr).map(itemKey), baseOid: base?.behindBy > 0 ? base.oid : null }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
98
|
+
|
|
99
|
+
export async function watch(opts, deps = {}) {
|
|
100
|
+
const env = deps.env ?? process.env
|
|
101
|
+
const fetch = deps.fetch ?? ((nwo, n) => {
|
|
102
|
+
const pr = fetchPr(nwo, n)
|
|
103
|
+
// A finished PR's head branch is often deleted already, which the comparison cannot name.
|
|
104
|
+
return { pr, base: pr.state === 'OPEN' ? fetchBaseStatus(nwo, pr) : null }
|
|
105
|
+
})
|
|
106
|
+
const wait = deps.sleep ?? sleep
|
|
107
|
+
const now = deps.now ?? (() => Date.now())
|
|
108
|
+
|
|
109
|
+
let nwo
|
|
110
|
+
let number
|
|
111
|
+
try {
|
|
112
|
+
nwo = deps.nwo ?? repoNwo()
|
|
113
|
+
number = deps.number ?? resolvePrNumber(opts.pr)
|
|
114
|
+
} catch (err) {
|
|
115
|
+
return { code: EXIT.error, event: { event: 'error', message: errorText(err) } }
|
|
116
|
+
}
|
|
117
|
+
const file = opts.state ?? defaultStatePath(nwo, number, env)
|
|
118
|
+
let state = readState(file)
|
|
119
|
+
const started = now()
|
|
120
|
+
let failures = 0
|
|
121
|
+
let first = true
|
|
122
|
+
|
|
123
|
+
for (;;) {
|
|
124
|
+
let polled
|
|
125
|
+
try {
|
|
126
|
+
polled = fetch(nwo, number)
|
|
127
|
+
failures = 0
|
|
128
|
+
} catch (err) {
|
|
129
|
+
// A first poll that fails is a setup problem (no PR, gh signed out), not a blip.
|
|
130
|
+
if (first || ++failures >= MAX_FAILURES) {
|
|
131
|
+
return { code: EXIT.error, event: { event: 'error', pr: number, message: errorText(err) } }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (polled) {
|
|
135
|
+
if (!state) {
|
|
136
|
+
state = opts.sinceNow ? baseline(polled.pr, polled.base) : { seen: [], baseOid: null }
|
|
137
|
+
writeState(file, state)
|
|
138
|
+
}
|
|
139
|
+
const result = decide(polled.pr, polled.base, state)
|
|
140
|
+
if (result.event) {
|
|
141
|
+
writeState(file, result.state)
|
|
142
|
+
return { code: EXIT[result.event.event] ?? EXIT.done, event: result.event }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
first = false
|
|
146
|
+
if (opts.once || (opts.maxWait && now() - started >= opts.maxWait * 1000)) {
|
|
147
|
+
return { code: EXIT.timeout, event: { event: 'timeout', pr: number } }
|
|
148
|
+
}
|
|
149
|
+
const backoff = failures ? Math.min(MAX_BACKOFF, opts.interval * 2 ** failures) : opts.interval
|
|
150
|
+
await wait(backoff * 1000)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function errorText(err) {
|
|
155
|
+
return String(err?.stderr || err?.message || err).trim().split('\n').slice(-3).join(' ')
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
159
|
+
let opts
|
|
160
|
+
try {
|
|
161
|
+
opts = parseArgs(process.argv.slice(2))
|
|
162
|
+
} catch (err) {
|
|
163
|
+
console.log(JSON.stringify({ event: 'error', message: errorText(err) }))
|
|
164
|
+
process.exit(EXIT.error)
|
|
165
|
+
}
|
|
166
|
+
const { code, event } = await watch(opts)
|
|
167
|
+
console.log(JSON.stringify(event))
|
|
168
|
+
process.exit(code)
|
|
169
|
+
}
|
package/dist/vibeflow.mjs
CHANGED
|
@@ -212,6 +212,12 @@ var init_pty = __esm({
|
|
|
212
212
|
}
|
|
213
213
|
async start(key, options) {
|
|
214
214
|
const { cwd, command, onExit, cols = 80, rows = 24, fresh = false } = options;
|
|
215
|
+
const running = this.sessions.get(key);
|
|
216
|
+
if (running && !command && !fresh && running.cwd === cwd) {
|
|
217
|
+
running.onExit = onExit;
|
|
218
|
+
if (options.cols && options.rows) this.resize(key, options.cols, options.rows);
|
|
219
|
+
return { pid: running.proc.pid, scrollback: this.scrollback(key), attached: true };
|
|
220
|
+
}
|
|
215
221
|
const clearScrollback = Boolean(command) || fresh;
|
|
216
222
|
const scrollback = clearScrollback ? null : this.scrollbacks.get(key) ?? null;
|
|
217
223
|
if (clearScrollback) this.scrollbacks.delete(key);
|
|
@@ -224,7 +230,8 @@ var init_pty = __esm({
|
|
|
224
230
|
cols,
|
|
225
231
|
rows
|
|
226
232
|
});
|
|
227
|
-
|
|
233
|
+
const session = { proc, cwd, onExit };
|
|
234
|
+
this.sessions.set(key, session);
|
|
228
235
|
proc.onData((data) => {
|
|
229
236
|
this.appendScrollback(key, data);
|
|
230
237
|
if (!this.sink.isDestroyed()) this.sink.send("pty:data", { sessionKey: key, data });
|
|
@@ -233,24 +240,24 @@ var init_pty = __esm({
|
|
|
233
240
|
const intentional = intentionalKills.has(proc);
|
|
234
241
|
if (!this.sink.isDestroyed())
|
|
235
242
|
this.sink.send("pty:exit", { sessionKey: key, exitCode, intentional });
|
|
236
|
-
if (this.sessions.get(key) ===
|
|
243
|
+
if (this.sessions.get(key) === session) {
|
|
237
244
|
this.sessions.delete(key);
|
|
238
|
-
onExit?.();
|
|
245
|
+
session.onExit?.();
|
|
239
246
|
}
|
|
240
247
|
});
|
|
241
248
|
return { pid: proc.pid, scrollback };
|
|
242
249
|
}
|
|
243
250
|
write(key, data) {
|
|
244
|
-
this.sessions.get(key)?.write(data);
|
|
251
|
+
this.sessions.get(key)?.proc.write(data);
|
|
245
252
|
}
|
|
246
253
|
resize(key, cols, rows) {
|
|
247
254
|
try {
|
|
248
|
-
this.sessions.get(key)?.resize(Math.max(cols, 1), Math.max(rows, 1));
|
|
255
|
+
this.sessions.get(key)?.proc.resize(Math.max(cols, 1), Math.max(rows, 1));
|
|
249
256
|
} catch {
|
|
250
257
|
}
|
|
251
258
|
}
|
|
252
259
|
killNow(key) {
|
|
253
|
-
const proc = this.sessions.get(key);
|
|
260
|
+
const proc = this.sessions.get(key)?.proc;
|
|
254
261
|
if (!proc) return;
|
|
255
262
|
intentionalKills.add(proc);
|
|
256
263
|
try {
|
|
@@ -709,7 +716,9 @@ function assembleCommand(agent, systemPrompt, prompt, model, effort, opts, workt
|
|
|
709
716
|
const addDir = workspacePath ? ` --add-dir ${shellQuote(toShellPath(workspacePath))}` : "";
|
|
710
717
|
const modelFlag = model ? ` --model ${model}` : "";
|
|
711
718
|
const effortFlag = effort && effort !== "auto" ? ` --effort ${effort}` : "";
|
|
712
|
-
const
|
|
719
|
+
const library = opts?.library;
|
|
720
|
+
const libraryFlags = library ? ` --plugin-dir ${shellQuote(toShellPath(library.pluginDir))} --add-dir ${shellQuote(toShellPath(library.libraryDir))}` : "";
|
|
721
|
+
const flags = `--chrome${claudePermissionFlag(opts?.autoMode)}${modelFlag}${effortFlag}${settings}${addDir}${libraryFlags}`;
|
|
713
722
|
const sysFlag = systemPrompt ? ` --append-system-prompt ${shellQuote(systemPrompt)}` : "";
|
|
714
723
|
const promptArg = prompt ? ` -- ${shellQuote(prompt)}` : "";
|
|
715
724
|
const tail = `${flags}${sysFlag}${promptArg}`;
|
|
@@ -723,7 +732,8 @@ function assembleCommand(agent, systemPrompt, prompt, model, effort, opts, workt
|
|
|
723
732
|
model ? `--model ${model}` : "",
|
|
724
733
|
combined ? shellQuote(combined) : ""
|
|
725
734
|
].filter(Boolean);
|
|
726
|
-
|
|
735
|
+
const codexHome = opts?.library ? `CODEX_HOME=${shellQuote(toShellPath(opts.library.codexHome))} ` : "";
|
|
736
|
+
cmd = `${codexHome}${["codex", ...args].join(" ")}\r`;
|
|
727
737
|
}
|
|
728
738
|
if (cmd.length > 2e5) console.warn(`[VibeFlow] launch command is ${cmd.length} bytes \u2014 approaching ARG_MAX`);
|
|
729
739
|
return cmd;
|
|
@@ -740,7 +750,7 @@ function taskModel(task) {
|
|
|
740
750
|
function buildAgentCommand(task, systemPrompt, opts, workspacePath) {
|
|
741
751
|
const agent = taskAgent(task);
|
|
742
752
|
const model = taskModel(task);
|
|
743
|
-
const custom = resolveSystemPrompt(systemPrompt);
|
|
753
|
+
const custom = [opts?.library?.promptText?.trim(), resolveSystemPrompt(systemPrompt)].filter(Boolean).join("\n\n");
|
|
744
754
|
const canWrite = Boolean(opts?.boardCli?.cliPath);
|
|
745
755
|
const role = task.role === "master" ? masterSystemPrompt({ canWrite, autoMode: opts?.autoMode === true }) : task.masterId ? slaveSystemPrompt({ canWrite }) : null;
|
|
746
756
|
const sys = task.masterId && task.role !== "master" ? role ?? "" : role ? [custom, role].filter(Boolean).join("\n\n") : custom;
|
|
@@ -1218,7 +1228,7 @@ var init_progress = __esm({
|
|
|
1218
1228
|
// packages/tui/src/task-form.ts
|
|
1219
1229
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
1220
1230
|
import fs27 from "fs";
|
|
1221
|
-
import
|
|
1231
|
+
import os10 from "os";
|
|
1222
1232
|
import path30 from "path";
|
|
1223
1233
|
import React, { useEffect, useRef, useState } from "react";
|
|
1224
1234
|
import { Box, Text, render as render2, useApp, useInput } from "ink";
|
|
@@ -1356,7 +1366,7 @@ function editorCommand(env, platform) {
|
|
|
1356
1366
|
return env.VISUAL?.trim() || env.EDITOR?.trim() || (platform === "win32" ? "notepad" : "vi");
|
|
1357
1367
|
}
|
|
1358
1368
|
function editInEditor(text) {
|
|
1359
|
-
const dir = fs27.mkdtempSync(path30.join(
|
|
1369
|
+
const dir = fs27.mkdtempSync(path30.join(os10.tmpdir(), "vibeflow-"));
|
|
1360
1370
|
const file = path30.join(dir, "description.md");
|
|
1361
1371
|
try {
|
|
1362
1372
|
fs27.writeFileSync(file, text);
|
|
@@ -1437,9 +1447,9 @@ function FormView({ api, ctx, initial, initialFocus, initialMessage, pristine, o
|
|
|
1437
1447
|
if (editing === "title") setS((prev) => ({ ...prev, title: draft }));
|
|
1438
1448
|
else if (editing === "branch") setS((prev) => ({ ...prev, branch: value2 }));
|
|
1439
1449
|
else if (editing === "project") {
|
|
1440
|
-
if (value2) setProject(path30.resolve(value2.replace(/^~(?=$|\/)/,
|
|
1450
|
+
if (value2) setProject(path30.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir())));
|
|
1441
1451
|
} else if (editing === "attachments" && value2) {
|
|
1442
|
-
const file = path30.resolve(value2.replace(/^~(?=$|\/)/,
|
|
1452
|
+
const file = path30.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir()));
|
|
1443
1453
|
if (!fs27.existsSync(file) || !fs27.statSync(file).isFile()) {
|
|
1444
1454
|
setMessage(`\u627E\u4E0D\u5230\u6A94\u6848\uFF1A${file}`);
|
|
1445
1455
|
return;
|
|
@@ -5162,6 +5172,7 @@ import path15 from "path";
|
|
|
5162
5172
|
// packages/core/src/library.ts
|
|
5163
5173
|
import { createHash } from "crypto";
|
|
5164
5174
|
import fs11 from "fs";
|
|
5175
|
+
import os3 from "os";
|
|
5165
5176
|
import path14 from "path";
|
|
5166
5177
|
var LIBRARY_DIR = "library";
|
|
5167
5178
|
var LIBRARY_KINDS = ["skill", "prompt", "script"];
|
|
@@ -5178,6 +5189,7 @@ function libraryPaths(root) {
|
|
|
5178
5189
|
skills: path14.join(root, KIND_DIR.skill),
|
|
5179
5190
|
prompts: path14.join(root, KIND_DIR.prompt),
|
|
5180
5191
|
scripts: path14.join(root, KIND_DIR.script),
|
|
5192
|
+
plugin: path14.join(root, "plugin"),
|
|
5181
5193
|
codexHome: path14.join(root, "codex-home")
|
|
5182
5194
|
};
|
|
5183
5195
|
}
|
|
@@ -5432,6 +5444,135 @@ function skillNamesIn(dir) {
|
|
|
5432
5444
|
return [];
|
|
5433
5445
|
}
|
|
5434
5446
|
}
|
|
5447
|
+
function projectSkillsDir(worktreePath) {
|
|
5448
|
+
return path14.join(worktreePath, ".claude", "skills");
|
|
5449
|
+
}
|
|
5450
|
+
var PLUGIN_MANIFEST_DIR = ".claude-plugin";
|
|
5451
|
+
function buildPluginDir(root) {
|
|
5452
|
+
const paths = libraryPaths(root);
|
|
5453
|
+
const enabled = listLibrary(root).filter((e) => e.kind === "skill" && e.enabled);
|
|
5454
|
+
fs11.rmSync(path14.join(paths.plugin, "skills"), { recursive: true, force: true });
|
|
5455
|
+
fs11.mkdirSync(path14.join(paths.plugin, PLUGIN_MANIFEST_DIR), { recursive: true });
|
|
5456
|
+
fs11.mkdirSync(path14.join(paths.plugin, "skills"), { recursive: true });
|
|
5457
|
+
fs11.writeFileSync(
|
|
5458
|
+
path14.join(paths.plugin, PLUGIN_MANIFEST_DIR, "plugin.json"),
|
|
5459
|
+
`${JSON.stringify(
|
|
5460
|
+
{
|
|
5461
|
+
name: "vibeflow-library",
|
|
5462
|
+
version: "1.0.0",
|
|
5463
|
+
description: "Skills delivered by VibeFlow for this task."
|
|
5464
|
+
},
|
|
5465
|
+
null,
|
|
5466
|
+
2
|
|
5467
|
+
)}
|
|
5468
|
+
`
|
|
5469
|
+
);
|
|
5470
|
+
for (const entry of enabled) {
|
|
5471
|
+
fs11.cpSync(entry.path, path14.join(paths.plugin, "skills", entry.name), {
|
|
5472
|
+
recursive: true,
|
|
5473
|
+
dereference: true
|
|
5474
|
+
});
|
|
5475
|
+
}
|
|
5476
|
+
return { pluginDir: paths.plugin, skills: enabled.map((e) => e.name) };
|
|
5477
|
+
}
|
|
5478
|
+
function linkOrSkip(target, linkPath) {
|
|
5479
|
+
if (!fs11.existsSync(target)) return false;
|
|
5480
|
+
const source = path14.resolve(target);
|
|
5481
|
+
const attempts = fs11.statSync(source).isDirectory() ? [
|
|
5482
|
+
() => fs11.symlinkSync(source, linkPath, "junction"),
|
|
5483
|
+
() => fs11.cpSync(source, linkPath, { recursive: true, dereference: true })
|
|
5484
|
+
] : [
|
|
5485
|
+
() => fs11.symlinkSync(source, linkPath),
|
|
5486
|
+
() => fs11.linkSync(source, linkPath),
|
|
5487
|
+
() => fs11.copyFileSync(source, linkPath)
|
|
5488
|
+
];
|
|
5489
|
+
for (const attempt of attempts) {
|
|
5490
|
+
try {
|
|
5491
|
+
fs11.rmSync(linkPath, { recursive: true, force: true });
|
|
5492
|
+
attempt();
|
|
5493
|
+
return true;
|
|
5494
|
+
} catch {
|
|
5495
|
+
}
|
|
5496
|
+
}
|
|
5497
|
+
return false;
|
|
5498
|
+
}
|
|
5499
|
+
function buildCodexHome(root, worktreePath, userCodexHome = path14.join(os3.homedir(), ".codex")) {
|
|
5500
|
+
const paths = libraryPaths(root);
|
|
5501
|
+
const skillsDir = path14.join(paths.codexHome, "skills");
|
|
5502
|
+
fs11.rmSync(skillsDir, { recursive: true, force: true });
|
|
5503
|
+
fs11.mkdirSync(skillsDir, { recursive: true });
|
|
5504
|
+
for (const file of ["auth.json", "config.toml"]) {
|
|
5505
|
+
linkOrSkip(path14.join(userCodexHome, file), path14.join(paths.codexHome, file));
|
|
5506
|
+
}
|
|
5507
|
+
const result = {
|
|
5508
|
+
codexHome: paths.codexHome,
|
|
5509
|
+
project: [],
|
|
5510
|
+
user: [],
|
|
5511
|
+
library: [],
|
|
5512
|
+
shadowed: []
|
|
5513
|
+
};
|
|
5514
|
+
const claimed = /* @__PURE__ */ new Map();
|
|
5515
|
+
const projectDir = worktreePath ? projectSkillsDir(worktreePath) : void 0;
|
|
5516
|
+
if (projectDir) {
|
|
5517
|
+
for (const name of skillNamesIn(projectDir)) {
|
|
5518
|
+
if (linkOrSkip(path14.join(projectDir, name), path14.join(skillsDir, name))) {
|
|
5519
|
+
result.project.push(name);
|
|
5520
|
+
claimed.set(name, "project");
|
|
5521
|
+
}
|
|
5522
|
+
}
|
|
5523
|
+
}
|
|
5524
|
+
const userDir = path14.join(userCodexHome, "skills");
|
|
5525
|
+
for (const name of skillNamesIn(userDir)) {
|
|
5526
|
+
const owner = claimed.get(name);
|
|
5527
|
+
if (owner) {
|
|
5528
|
+
result.shadowed.push({ name, keptFrom: owner, dropped: "user" });
|
|
5529
|
+
continue;
|
|
5530
|
+
}
|
|
5531
|
+
if (linkOrSkip(path14.join(userDir, name), path14.join(skillsDir, name))) {
|
|
5532
|
+
result.user.push(name);
|
|
5533
|
+
claimed.set(name, "user");
|
|
5534
|
+
}
|
|
5535
|
+
}
|
|
5536
|
+
for (const entry of listLibrary(root)) {
|
|
5537
|
+
if (entry.kind !== "skill" || !entry.enabled) continue;
|
|
5538
|
+
const owner = claimed.get(entry.name);
|
|
5539
|
+
if (owner) {
|
|
5540
|
+
result.shadowed.push({ name: entry.name, keptFrom: owner, dropped: "library" });
|
|
5541
|
+
continue;
|
|
5542
|
+
}
|
|
5543
|
+
fs11.cpSync(entry.path, path14.join(skillsDir, entry.name), {
|
|
5544
|
+
recursive: true,
|
|
5545
|
+
dereference: true
|
|
5546
|
+
});
|
|
5547
|
+
result.library.push(entry.name);
|
|
5548
|
+
}
|
|
5549
|
+
return result;
|
|
5550
|
+
}
|
|
5551
|
+
function libraryLaunchInfoAt(root, worktreePath, userCodexHome) {
|
|
5552
|
+
const entries = listLibrary(root).filter((e) => e.enabled);
|
|
5553
|
+
if (entries.length === 0) return null;
|
|
5554
|
+
const { pluginDir } = buildPluginDir(root);
|
|
5555
|
+
const { codexHome } = buildCodexHome(root, worktreePath, userCodexHome);
|
|
5556
|
+
const scripts = entries.filter((e) => e.kind === "script").map((e) => ({ name: e.name, path: e.path, description: e.description }));
|
|
5557
|
+
const promptBodies = entries.filter((e) => e.kind === "prompt").map((e) => readEntryContent(root, "prompt", e.name).trim()).filter(Boolean);
|
|
5558
|
+
const lines = [...promptBodies];
|
|
5559
|
+
if (scripts.length > 0) {
|
|
5560
|
+
lines.push(
|
|
5561
|
+
"\u53EF\u7528\u7684\u5DE5\u5177\u8173\u672C\uFF08\u9700\u8981\u6642\u81EA\u884C\u57F7\u884C\uFF0C\u4E0D\u9700\u8981\u5C31\u5225\u8DD1\uFF09\uFF1A",
|
|
5562
|
+
...scripts.map((s) => `- ${s.path}${s.description ? ` \u2014 ${s.description}` : ""}`)
|
|
5563
|
+
);
|
|
5564
|
+
}
|
|
5565
|
+
return {
|
|
5566
|
+
pluginDir,
|
|
5567
|
+
codexHome,
|
|
5568
|
+
libraryDir: root,
|
|
5569
|
+
scripts,
|
|
5570
|
+
promptText: lines.join("\n\n")
|
|
5571
|
+
};
|
|
5572
|
+
}
|
|
5573
|
+
async function libraryLaunchInfo(worktreePath) {
|
|
5574
|
+
return libraryLaunchInfoAt(await libraryRoot(), worktreePath);
|
|
5575
|
+
}
|
|
5435
5576
|
|
|
5436
5577
|
// packages/core/src/library-builtins.ts
|
|
5437
5578
|
function builtinSkillsDir() {
|
|
@@ -5541,7 +5682,7 @@ import fs21 from "fs";
|
|
|
5541
5682
|
// packages/core/src/terminal-files.ts
|
|
5542
5683
|
import { constants } from "fs";
|
|
5543
5684
|
import fs13 from "fs/promises";
|
|
5544
|
-
import
|
|
5685
|
+
import os4 from "os";
|
|
5545
5686
|
import path16 from "path";
|
|
5546
5687
|
import { fileURLToPath } from "url";
|
|
5547
5688
|
var MAX_PREVIEW_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
@@ -5566,7 +5707,7 @@ function resolveTerminalFile(cwd, input) {
|
|
|
5566
5707
|
} else if (/^[a-z][a-z\d+.-]*:/i.test(target) && !/^[a-z]:[\\/]/i.test(target)) {
|
|
5567
5708
|
throw new Error("\u53EA\u652F\u63F4\u672C\u6A5F\u6A94\u6848\u8DEF\u5F91\u3002");
|
|
5568
5709
|
}
|
|
5569
|
-
if (target.startsWith("~/") || target.startsWith("~\\")) target = path16.join(
|
|
5710
|
+
if (target.startsWith("~/") || target.startsWith("~\\")) target = path16.join(os4.homedir(), target.slice(2));
|
|
5570
5711
|
if (target.includes("\0")) throw new Error("\u6A94\u6848\u8DEF\u5F91\u7121\u6548\u3002");
|
|
5571
5712
|
return path16.resolve(cwd, target);
|
|
5572
5713
|
}
|
|
@@ -5628,19 +5769,19 @@ async function readTerminalFile(cwd, input, metadataOnly = false) {
|
|
|
5628
5769
|
}
|
|
5629
5770
|
|
|
5630
5771
|
// packages/core/src/service.ts
|
|
5631
|
-
import
|
|
5772
|
+
import os9 from "os";
|
|
5632
5773
|
import path24 from "path";
|
|
5633
5774
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
5634
5775
|
|
|
5635
5776
|
// packages/core/src/agent-models.ts
|
|
5636
5777
|
import fs15 from "fs";
|
|
5637
|
-
import
|
|
5778
|
+
import os7 from "os";
|
|
5638
5779
|
import path18 from "path";
|
|
5639
5780
|
|
|
5640
5781
|
// packages/core/src/claude-models.ts
|
|
5641
5782
|
init_effort();
|
|
5642
5783
|
import fs14 from "fs";
|
|
5643
|
-
import
|
|
5784
|
+
import os5 from "os";
|
|
5644
5785
|
import path17 from "path";
|
|
5645
5786
|
|
|
5646
5787
|
// packages/core/src/json-lines-process.ts
|
|
@@ -5745,7 +5886,7 @@ var CLAUDE_MODELS_TIMEOUT_MS = 15e3;
|
|
|
5745
5886
|
var REQUEST_ID = "vibeflow-models";
|
|
5746
5887
|
var CLAUDE_ARGS = ["-p", "--input-format", "stream-json", "--output-format", "stream-json", "--verbose"];
|
|
5747
5888
|
function openClaude() {
|
|
5748
|
-
const cwd = fs14.mkdtempSync(path17.join(
|
|
5889
|
+
const cwd = fs14.mkdtempSync(path17.join(os5.tmpdir(), "vf-claude-models-"));
|
|
5749
5890
|
return spawnJsonLines("claude", CLAUDE_ARGS, {
|
|
5750
5891
|
cwd,
|
|
5751
5892
|
timeoutMs: CLAUDE_MODELS_TIMEOUT_MS,
|
|
@@ -5796,7 +5937,7 @@ async function fetchClaudeModels(open = openClaude) {
|
|
|
5796
5937
|
// packages/core/src/codex-models.ts
|
|
5797
5938
|
init_effort();
|
|
5798
5939
|
init_env();
|
|
5799
|
-
import
|
|
5940
|
+
import os6 from "os";
|
|
5800
5941
|
var CODEX_MODELS_TIMEOUT_MS = 2e4;
|
|
5801
5942
|
var MAX_PAGES = 20;
|
|
5802
5943
|
var CodexLoginRequiredError = class extends Error {
|
|
@@ -5809,7 +5950,7 @@ function codexAppServerCommand() {
|
|
|
5809
5950
|
return {
|
|
5810
5951
|
bin: "codex",
|
|
5811
5952
|
args: ["app-server", "--listen", "stdio://"],
|
|
5812
|
-
cwd:
|
|
5953
|
+
cwd: os6.homedir(),
|
|
5813
5954
|
env: execEnv()
|
|
5814
5955
|
};
|
|
5815
5956
|
}
|
|
@@ -5898,7 +6039,7 @@ function builtinModels(id) {
|
|
|
5898
6039
|
}
|
|
5899
6040
|
function defaultCodexHome() {
|
|
5900
6041
|
const configured = process.env.CODEX_HOME?.trim();
|
|
5901
|
-
return configured ? configured : path18.join(
|
|
6042
|
+
return configured ? configured : path18.join(os7.homedir(), ".codex");
|
|
5902
6043
|
}
|
|
5903
6044
|
function parseCodexCatalog(raw) {
|
|
5904
6045
|
const body = JSON.parse(raw);
|
|
@@ -7139,7 +7280,7 @@ init_launch();
|
|
|
7139
7280
|
init_progress();
|
|
7140
7281
|
init_launch();
|
|
7141
7282
|
import fs20 from "fs";
|
|
7142
|
-
import
|
|
7283
|
+
import os8 from "os";
|
|
7143
7284
|
import path23 from "path";
|
|
7144
7285
|
var SINCE_SLACK_MS = 5e3;
|
|
7145
7286
|
function claudeProjectDir(home, cwd) {
|
|
@@ -7240,7 +7381,7 @@ function codexDayDirs(sessionsRoot, since) {
|
|
|
7240
7381
|
return days;
|
|
7241
7382
|
}
|
|
7242
7383
|
function createProgressTracker(opts) {
|
|
7243
|
-
const home = opts.homeDir ??
|
|
7384
|
+
const home = opts.homeDir ?? os8.homedir();
|
|
7244
7385
|
const codexHomes = opts.codexHomes ?? (() => [path23.join(home, ".codex")]);
|
|
7245
7386
|
const pollMs = opts.pollMs ?? 2e3;
|
|
7246
7387
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -7685,7 +7826,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7685
7826
|
libraryCodexHome = libraryPaths(root).codexHome;
|
|
7686
7827
|
}).catch(() => {
|
|
7687
7828
|
});
|
|
7688
|
-
const home = homeDir ??
|
|
7829
|
+
const home = homeDir ?? os9.homedir();
|
|
7689
7830
|
const progress = createProgressTracker({
|
|
7690
7831
|
homeDir: home,
|
|
7691
7832
|
codexHomes: () => [path24.join(home, ".codex"), ...libraryCodexHome ? [libraryCodexHome] : []],
|
|
@@ -7802,7 +7943,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7802
7943
|
const task2 = requireTask(saved.taskId);
|
|
7803
7944
|
return str(task2.worktreePath ?? task2.projectPath, "directory");
|
|
7804
7945
|
}
|
|
7805
|
-
return saved?.projectPath ??
|
|
7946
|
+
return saved?.projectPath ?? os9.homedir();
|
|
7806
7947
|
}
|
|
7807
7948
|
const task = requireTask(key.split(":")[0]);
|
|
7808
7949
|
return str(task.worktreePath ?? task.projectPath, "directory");
|
|
@@ -7820,6 +7961,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7820
7961
|
}
|
|
7821
7962
|
async function launchCommand(task, intent) {
|
|
7822
7963
|
const settings = getSettings();
|
|
7964
|
+
const library = await libraryLaunchInfo(task.worktreePath);
|
|
7823
7965
|
const boardCli = await boardCliLaunchInfo();
|
|
7824
7966
|
let route = settledRoute(task);
|
|
7825
7967
|
const needsRoute = !taskModel(task) || task.effort === "auto";
|
|
@@ -7856,6 +7998,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7856
7998
|
{
|
|
7857
7999
|
resume: intent.resume === true,
|
|
7858
8000
|
includeTaskPrompt: intent.includeTaskPrompt !== false,
|
|
8001
|
+
library: library ?? void 0,
|
|
7859
8002
|
boardCli,
|
|
7860
8003
|
autoMode: task.autoMode ?? settings.autoMode,
|
|
7861
8004
|
preface
|
|
@@ -7865,7 +8008,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7865
8008
|
}
|
|
7866
8009
|
function claudeSessionFile(cwd, sessionId) {
|
|
7867
8010
|
const munged = cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
7868
|
-
return path24.join(
|
|
8011
|
+
return path24.join(os9.homedir(), ".claude", "projects", munged, `${sessionId}.jsonl`);
|
|
7869
8012
|
}
|
|
7870
8013
|
async function removeTaskWorktree(task) {
|
|
7871
8014
|
if (!task.projectPath || !task.worktreePath) return;
|
|
@@ -8351,7 +8494,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
8351
8494
|
cwd = str(p.projectPath, "projectPath");
|
|
8352
8495
|
projectPath = cwd;
|
|
8353
8496
|
} else {
|
|
8354
|
-
cwd =
|
|
8497
|
+
cwd = os9.homedir();
|
|
8355
8498
|
}
|
|
8356
8499
|
if (!path24.isAbsolute(cwd) || !fs21.existsSync(cwd) || !fs21.statSync(cwd).isDirectory()) {
|
|
8357
8500
|
invalid("terminal directory must be an existing absolute directory");
|
package/dist/web/404/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><link rel="manifest" href="/manifest.webmanifest" data-next-head=""/><meta name="theme-color" content="#0d1117" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><link rel="manifest" href="/manifest.webmanifest" data-next-head=""/><meta name="theme-color" content="#0d1117" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/650f4825184c406d.css" as="style"/><link rel="stylesheet" href="/_next/static/css/650f4825184c406d.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-d7cc7d90e557abc8.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-ba514e8a4a55baf5.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8f65b0f8749f42d2.js" defer=""></script><script src="/_next/static/f-KIgR-HyA9O87YmYdD4w/_buildManifest.js" defer=""></script><script src="/_next/static/f-KIgR-HyA9O87YmYdD4w/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"f-KIgR-HyA9O87YmYdD4w","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
package/dist/web/404.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><link rel="manifest" href="/manifest.webmanifest" data-next-head=""/><meta name="theme-color" content="#0d1117" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><link rel="icon" href="/favicon.ico" sizes="any" data-next-head=""/><link rel="icon" href="/logo.svg" type="image/svg+xml" data-next-head=""/><link rel="apple-touch-icon" href="/apple-touch-icon.png" data-next-head=""/><link rel="manifest" href="/manifest.webmanifest" data-next-head=""/><meta name="theme-color" content="#0d1117" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/650f4825184c406d.css" as="style"/><link rel="stylesheet" href="/_next/static/css/650f4825184c406d.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-d7cc7d90e557abc8.js" defer=""></script><script src="/_next/static/chunks/framework-b92a367cf1ad4bf7.js" defer=""></script><script src="/_next/static/chunks/main-ec7fd4c371d06729.js" defer=""></script><script src="/_next/static/chunks/pages/_app-ba514e8a4a55baf5.js" defer=""></script><script src="/_next/static/chunks/pages/_error-8f65b0f8749f42d2.js" defer=""></script><script src="/_next/static/f-KIgR-HyA9O87YmYdD4w/_buildManifest.js" defer=""></script><script src="/_next/static/f-KIgR-HyA9O87YmYdD4w/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"f-KIgR-HyA9O87YmYdD4w","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|