@kw-yeh/vibeflow 4.11.53 → 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 +158 -22
- package/dist/web/404/index.html +1 -1
- package/dist/web/404.html +1 -1
- package/dist/web/_next/static/chunks/pages/{home-e3338c9521a00472.js → home-a1f82648d0008f6b.js} +8 -8
- package/dist/web/_next/static/chunks/{webpack-1f79da4960e22d5d.js → webpack-d7cc7d90e557abc8.js} +1 -1
- package/dist/web/_next/static/{Vk6Unwy2uuNpsf510aqWR → 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/{Vk6Unwy2uuNpsf510aqWR → 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
|
@@ -716,7 +716,9 @@ function assembleCommand(agent, systemPrompt, prompt, model, effort, opts, workt
|
|
|
716
716
|
const addDir = workspacePath ? ` --add-dir ${shellQuote(toShellPath(workspacePath))}` : "";
|
|
717
717
|
const modelFlag = model ? ` --model ${model}` : "";
|
|
718
718
|
const effortFlag = effort && effort !== "auto" ? ` --effort ${effort}` : "";
|
|
719
|
-
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}`;
|
|
720
722
|
const sysFlag = systemPrompt ? ` --append-system-prompt ${shellQuote(systemPrompt)}` : "";
|
|
721
723
|
const promptArg = prompt ? ` -- ${shellQuote(prompt)}` : "";
|
|
722
724
|
const tail = `${flags}${sysFlag}${promptArg}`;
|
|
@@ -730,7 +732,8 @@ function assembleCommand(agent, systemPrompt, prompt, model, effort, opts, workt
|
|
|
730
732
|
model ? `--model ${model}` : "",
|
|
731
733
|
combined ? shellQuote(combined) : ""
|
|
732
734
|
].filter(Boolean);
|
|
733
|
-
|
|
735
|
+
const codexHome = opts?.library ? `CODEX_HOME=${shellQuote(toShellPath(opts.library.codexHome))} ` : "";
|
|
736
|
+
cmd = `${codexHome}${["codex", ...args].join(" ")}\r`;
|
|
734
737
|
}
|
|
735
738
|
if (cmd.length > 2e5) console.warn(`[VibeFlow] launch command is ${cmd.length} bytes \u2014 approaching ARG_MAX`);
|
|
736
739
|
return cmd;
|
|
@@ -747,7 +750,7 @@ function taskModel(task) {
|
|
|
747
750
|
function buildAgentCommand(task, systemPrompt, opts, workspacePath) {
|
|
748
751
|
const agent = taskAgent(task);
|
|
749
752
|
const model = taskModel(task);
|
|
750
|
-
const custom = resolveSystemPrompt(systemPrompt);
|
|
753
|
+
const custom = [opts?.library?.promptText?.trim(), resolveSystemPrompt(systemPrompt)].filter(Boolean).join("\n\n");
|
|
751
754
|
const canWrite = Boolean(opts?.boardCli?.cliPath);
|
|
752
755
|
const role = task.role === "master" ? masterSystemPrompt({ canWrite, autoMode: opts?.autoMode === true }) : task.masterId ? slaveSystemPrompt({ canWrite }) : null;
|
|
753
756
|
const sys = task.masterId && task.role !== "master" ? role ?? "" : role ? [custom, role].filter(Boolean).join("\n\n") : custom;
|
|
@@ -1225,7 +1228,7 @@ var init_progress = __esm({
|
|
|
1225
1228
|
// packages/tui/src/task-form.ts
|
|
1226
1229
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
1227
1230
|
import fs27 from "fs";
|
|
1228
|
-
import
|
|
1231
|
+
import os10 from "os";
|
|
1229
1232
|
import path30 from "path";
|
|
1230
1233
|
import React, { useEffect, useRef, useState } from "react";
|
|
1231
1234
|
import { Box, Text, render as render2, useApp, useInput } from "ink";
|
|
@@ -1363,7 +1366,7 @@ function editorCommand(env, platform) {
|
|
|
1363
1366
|
return env.VISUAL?.trim() || env.EDITOR?.trim() || (platform === "win32" ? "notepad" : "vi");
|
|
1364
1367
|
}
|
|
1365
1368
|
function editInEditor(text) {
|
|
1366
|
-
const dir = fs27.mkdtempSync(path30.join(
|
|
1369
|
+
const dir = fs27.mkdtempSync(path30.join(os10.tmpdir(), "vibeflow-"));
|
|
1367
1370
|
const file = path30.join(dir, "description.md");
|
|
1368
1371
|
try {
|
|
1369
1372
|
fs27.writeFileSync(file, text);
|
|
@@ -1444,9 +1447,9 @@ function FormView({ api, ctx, initial, initialFocus, initialMessage, pristine, o
|
|
|
1444
1447
|
if (editing === "title") setS((prev) => ({ ...prev, title: draft }));
|
|
1445
1448
|
else if (editing === "branch") setS((prev) => ({ ...prev, branch: value2 }));
|
|
1446
1449
|
else if (editing === "project") {
|
|
1447
|
-
if (value2) setProject(path30.resolve(value2.replace(/^~(?=$|\/)/,
|
|
1450
|
+
if (value2) setProject(path30.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir())));
|
|
1448
1451
|
} else if (editing === "attachments" && value2) {
|
|
1449
|
-
const file = path30.resolve(value2.replace(/^~(?=$|\/)/,
|
|
1452
|
+
const file = path30.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir()));
|
|
1450
1453
|
if (!fs27.existsSync(file) || !fs27.statSync(file).isFile()) {
|
|
1451
1454
|
setMessage(`\u627E\u4E0D\u5230\u6A94\u6848\uFF1A${file}`);
|
|
1452
1455
|
return;
|
|
@@ -5169,6 +5172,7 @@ import path15 from "path";
|
|
|
5169
5172
|
// packages/core/src/library.ts
|
|
5170
5173
|
import { createHash } from "crypto";
|
|
5171
5174
|
import fs11 from "fs";
|
|
5175
|
+
import os3 from "os";
|
|
5172
5176
|
import path14 from "path";
|
|
5173
5177
|
var LIBRARY_DIR = "library";
|
|
5174
5178
|
var LIBRARY_KINDS = ["skill", "prompt", "script"];
|
|
@@ -5185,6 +5189,7 @@ function libraryPaths(root) {
|
|
|
5185
5189
|
skills: path14.join(root, KIND_DIR.skill),
|
|
5186
5190
|
prompts: path14.join(root, KIND_DIR.prompt),
|
|
5187
5191
|
scripts: path14.join(root, KIND_DIR.script),
|
|
5192
|
+
plugin: path14.join(root, "plugin"),
|
|
5188
5193
|
codexHome: path14.join(root, "codex-home")
|
|
5189
5194
|
};
|
|
5190
5195
|
}
|
|
@@ -5439,6 +5444,135 @@ function skillNamesIn(dir) {
|
|
|
5439
5444
|
return [];
|
|
5440
5445
|
}
|
|
5441
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
|
+
}
|
|
5442
5576
|
|
|
5443
5577
|
// packages/core/src/library-builtins.ts
|
|
5444
5578
|
function builtinSkillsDir() {
|
|
@@ -5548,7 +5682,7 @@ import fs21 from "fs";
|
|
|
5548
5682
|
// packages/core/src/terminal-files.ts
|
|
5549
5683
|
import { constants } from "fs";
|
|
5550
5684
|
import fs13 from "fs/promises";
|
|
5551
|
-
import
|
|
5685
|
+
import os4 from "os";
|
|
5552
5686
|
import path16 from "path";
|
|
5553
5687
|
import { fileURLToPath } from "url";
|
|
5554
5688
|
var MAX_PREVIEW_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
@@ -5573,7 +5707,7 @@ function resolveTerminalFile(cwd, input) {
|
|
|
5573
5707
|
} else if (/^[a-z][a-z\d+.-]*:/i.test(target) && !/^[a-z]:[\\/]/i.test(target)) {
|
|
5574
5708
|
throw new Error("\u53EA\u652F\u63F4\u672C\u6A5F\u6A94\u6848\u8DEF\u5F91\u3002");
|
|
5575
5709
|
}
|
|
5576
|
-
if (target.startsWith("~/") || target.startsWith("~\\")) target = path16.join(
|
|
5710
|
+
if (target.startsWith("~/") || target.startsWith("~\\")) target = path16.join(os4.homedir(), target.slice(2));
|
|
5577
5711
|
if (target.includes("\0")) throw new Error("\u6A94\u6848\u8DEF\u5F91\u7121\u6548\u3002");
|
|
5578
5712
|
return path16.resolve(cwd, target);
|
|
5579
5713
|
}
|
|
@@ -5635,19 +5769,19 @@ async function readTerminalFile(cwd, input, metadataOnly = false) {
|
|
|
5635
5769
|
}
|
|
5636
5770
|
|
|
5637
5771
|
// packages/core/src/service.ts
|
|
5638
|
-
import
|
|
5772
|
+
import os9 from "os";
|
|
5639
5773
|
import path24 from "path";
|
|
5640
5774
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
5641
5775
|
|
|
5642
5776
|
// packages/core/src/agent-models.ts
|
|
5643
5777
|
import fs15 from "fs";
|
|
5644
|
-
import
|
|
5778
|
+
import os7 from "os";
|
|
5645
5779
|
import path18 from "path";
|
|
5646
5780
|
|
|
5647
5781
|
// packages/core/src/claude-models.ts
|
|
5648
5782
|
init_effort();
|
|
5649
5783
|
import fs14 from "fs";
|
|
5650
|
-
import
|
|
5784
|
+
import os5 from "os";
|
|
5651
5785
|
import path17 from "path";
|
|
5652
5786
|
|
|
5653
5787
|
// packages/core/src/json-lines-process.ts
|
|
@@ -5752,7 +5886,7 @@ var CLAUDE_MODELS_TIMEOUT_MS = 15e3;
|
|
|
5752
5886
|
var REQUEST_ID = "vibeflow-models";
|
|
5753
5887
|
var CLAUDE_ARGS = ["-p", "--input-format", "stream-json", "--output-format", "stream-json", "--verbose"];
|
|
5754
5888
|
function openClaude() {
|
|
5755
|
-
const cwd = fs14.mkdtempSync(path17.join(
|
|
5889
|
+
const cwd = fs14.mkdtempSync(path17.join(os5.tmpdir(), "vf-claude-models-"));
|
|
5756
5890
|
return spawnJsonLines("claude", CLAUDE_ARGS, {
|
|
5757
5891
|
cwd,
|
|
5758
5892
|
timeoutMs: CLAUDE_MODELS_TIMEOUT_MS,
|
|
@@ -5803,7 +5937,7 @@ async function fetchClaudeModels(open = openClaude) {
|
|
|
5803
5937
|
// packages/core/src/codex-models.ts
|
|
5804
5938
|
init_effort();
|
|
5805
5939
|
init_env();
|
|
5806
|
-
import
|
|
5940
|
+
import os6 from "os";
|
|
5807
5941
|
var CODEX_MODELS_TIMEOUT_MS = 2e4;
|
|
5808
5942
|
var MAX_PAGES = 20;
|
|
5809
5943
|
var CodexLoginRequiredError = class extends Error {
|
|
@@ -5816,7 +5950,7 @@ function codexAppServerCommand() {
|
|
|
5816
5950
|
return {
|
|
5817
5951
|
bin: "codex",
|
|
5818
5952
|
args: ["app-server", "--listen", "stdio://"],
|
|
5819
|
-
cwd:
|
|
5953
|
+
cwd: os6.homedir(),
|
|
5820
5954
|
env: execEnv()
|
|
5821
5955
|
};
|
|
5822
5956
|
}
|
|
@@ -5905,7 +6039,7 @@ function builtinModels(id) {
|
|
|
5905
6039
|
}
|
|
5906
6040
|
function defaultCodexHome() {
|
|
5907
6041
|
const configured = process.env.CODEX_HOME?.trim();
|
|
5908
|
-
return configured ? configured : path18.join(
|
|
6042
|
+
return configured ? configured : path18.join(os7.homedir(), ".codex");
|
|
5909
6043
|
}
|
|
5910
6044
|
function parseCodexCatalog(raw) {
|
|
5911
6045
|
const body = JSON.parse(raw);
|
|
@@ -7146,7 +7280,7 @@ init_launch();
|
|
|
7146
7280
|
init_progress();
|
|
7147
7281
|
init_launch();
|
|
7148
7282
|
import fs20 from "fs";
|
|
7149
|
-
import
|
|
7283
|
+
import os8 from "os";
|
|
7150
7284
|
import path23 from "path";
|
|
7151
7285
|
var SINCE_SLACK_MS = 5e3;
|
|
7152
7286
|
function claudeProjectDir(home, cwd) {
|
|
@@ -7247,7 +7381,7 @@ function codexDayDirs(sessionsRoot, since) {
|
|
|
7247
7381
|
return days;
|
|
7248
7382
|
}
|
|
7249
7383
|
function createProgressTracker(opts) {
|
|
7250
|
-
const home = opts.homeDir ??
|
|
7384
|
+
const home = opts.homeDir ?? os8.homedir();
|
|
7251
7385
|
const codexHomes = opts.codexHomes ?? (() => [path23.join(home, ".codex")]);
|
|
7252
7386
|
const pollMs = opts.pollMs ?? 2e3;
|
|
7253
7387
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -7692,7 +7826,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7692
7826
|
libraryCodexHome = libraryPaths(root).codexHome;
|
|
7693
7827
|
}).catch(() => {
|
|
7694
7828
|
});
|
|
7695
|
-
const home = homeDir ??
|
|
7829
|
+
const home = homeDir ?? os9.homedir();
|
|
7696
7830
|
const progress = createProgressTracker({
|
|
7697
7831
|
homeDir: home,
|
|
7698
7832
|
codexHomes: () => [path24.join(home, ".codex"), ...libraryCodexHome ? [libraryCodexHome] : []],
|
|
@@ -7809,7 +7943,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7809
7943
|
const task2 = requireTask(saved.taskId);
|
|
7810
7944
|
return str(task2.worktreePath ?? task2.projectPath, "directory");
|
|
7811
7945
|
}
|
|
7812
|
-
return saved?.projectPath ??
|
|
7946
|
+
return saved?.projectPath ?? os9.homedir();
|
|
7813
7947
|
}
|
|
7814
7948
|
const task = requireTask(key.split(":")[0]);
|
|
7815
7949
|
return str(task.worktreePath ?? task.projectPath, "directory");
|
|
@@ -7827,6 +7961,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7827
7961
|
}
|
|
7828
7962
|
async function launchCommand(task, intent) {
|
|
7829
7963
|
const settings = getSettings();
|
|
7964
|
+
const library = await libraryLaunchInfo(task.worktreePath);
|
|
7830
7965
|
const boardCli = await boardCliLaunchInfo();
|
|
7831
7966
|
let route = settledRoute(task);
|
|
7832
7967
|
const needsRoute = !taskModel(task) || task.effort === "auto";
|
|
@@ -7863,6 +7998,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7863
7998
|
{
|
|
7864
7999
|
resume: intent.resume === true,
|
|
7865
8000
|
includeTaskPrompt: intent.includeTaskPrompt !== false,
|
|
8001
|
+
library: library ?? void 0,
|
|
7866
8002
|
boardCli,
|
|
7867
8003
|
autoMode: task.autoMode ?? settings.autoMode,
|
|
7868
8004
|
preface
|
|
@@ -7872,7 +8008,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
7872
8008
|
}
|
|
7873
8009
|
function claudeSessionFile(cwd, sessionId) {
|
|
7874
8010
|
const munged = cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
7875
|
-
return path24.join(
|
|
8011
|
+
return path24.join(os9.homedir(), ".claude", "projects", munged, `${sessionId}.jsonl`);
|
|
7876
8012
|
}
|
|
7877
8013
|
async function removeTaskWorktree(task) {
|
|
7878
8014
|
if (!task.projectPath || !task.worktreePath) return;
|
|
@@ -8358,7 +8494,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
|
|
|
8358
8494
|
cwd = str(p.projectPath, "projectPath");
|
|
8359
8495
|
projectPath = cwd;
|
|
8360
8496
|
} else {
|
|
8361
|
-
cwd =
|
|
8497
|
+
cwd = os9.homedir();
|
|
8362
8498
|
}
|
|
8363
8499
|
if (!path24.isAbsolute(cwd) || !fs21.existsSync(cwd) || !fs21.statSync(cwd).isDirectory()) {
|
|
8364
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/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-
|
|
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/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-
|
|
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>
|