fix(daemon-beta t3): 真機 e2e 抓到 /wiki-extract 拒非 vault 資料夾——新增 daemon 專用 /rag-extract-file 命令(template overlay,prompt 活在 skill 檔),claude 路改呼叫它
This commit is contained in:
+4
-4
@@ -1,7 +1,7 @@
|
||||
// extract.go — 可插拔本地萃取器(daemon-beta task 3/4,四步定稿第 3 步)。
|
||||
//
|
||||
// leo 定稿:「由現在的 gemma4 幫你本地萃,或是用你自己的訂閱帳號,例如叫起 claude 幫你萃。」
|
||||
// - claude 路(task 3):執行 `claude -p "/wiki-capture <檔>"`,cwd=監看根——
|
||||
// - claude 路(task 3):執行 `claude -p "/rag-extract-file <檔>"`,cwd=監看根——
|
||||
// template 既有萃取流**原樣重用**(prompt 都不搬),卡片由 CC 寫進 system-dev/wiki/cards/。
|
||||
// 用戶自己的訂閱=我們零 API 成本。
|
||||
// - gemma 路(task 4):Go 內直呼 Gemini API,卡片由 daemon 自己寫進 cards/。
|
||||
@@ -54,7 +54,7 @@ func diffCards(before, after map[string]fileState) []string {
|
||||
// claudeExtractTimeout:單檔萃取上限。CC 冷啟+讀檔+寫卡實測分鐘級,給足裕度。
|
||||
const claudeExtractTimeout = 10 * time.Minute
|
||||
|
||||
// ExtractWithClaude 叫起用戶自己的 claude 跑 template 的 /wiki-capture(task 3)。
|
||||
// ExtractWithClaude 叫起用戶自己的 claude 跑 template 的 /rag-extract-file(task 3)。
|
||||
// binPath 空="claude"(PATH 尋找)。回傳本次產出的卡片相對路徑。
|
||||
func ExtractWithClaude(binPath, absRoot, relPath string) ([]string, error) {
|
||||
if binPath == "" {
|
||||
@@ -67,8 +67,8 @@ func ExtractWithClaude(binPath, absRoot, relPath string) ([]string, error) {
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), claudeExtractTimeout)
|
||||
defer cancel()
|
||||
// /wiki-capture=template 既有萃取 skill;cwd=監看根(template 已代裝,skill 就在 .claude/commands/)。
|
||||
cmd := exec.CommandContext(ctx, binPath, "-p", fmt.Sprintf("/wiki-capture %s", relPath))
|
||||
// /rag-extract-file=template 既有萃取 skill;cwd=監看根(template 已代裝,skill 就在 .claude/commands/)。
|
||||
cmd := exec.CommandContext(ctx, binPath, "-p", fmt.Sprintf("/rag-extract-file %s", relPath))
|
||||
cmd.Dir = absRoot
|
||||
out, err := cmd.CombinedOutput()
|
||||
if ctx.Err() == context.DeadlineExceeded {
|
||||
|
||||
Reference in New Issue
Block a user