Skip to content

[import-markdown] workspace-glob 導致 nested agent workspace 被略過 #484

@jlin53882

Description

@jlin53882

name: Bug report
about: import-markdown workspace-glob skips nested agent workspaces
title: "[import-markdown] workspace-glob 導致 nested agent workspace 被略過"
labels: bug, import-markdown

描述

當使用 workspace-glob 參數呼叫 import-markdown 時,nested agent workspace(如 workspace/agents/<id>/)會被完全略過,導致目標匯入時返回 0 個檔案。

重現步驟

memory-pro import-markdown <agent-id>

預期:匯入 workspace/agents/<agent-id>/MEMORY.mdworkspace/agents/<agent-id>/memory/*.md

實際:返回 0 個檔案(silent fail)

根因分析

邏輯如下:

Top-level 迴圈(cli.ts):
  for entry in workspace/  (例如 "agents", "test-ws", ...)
  → 只掃 workspace/<entry>/MEMORY.md 和 workspace/<entry>/memory/

Nested scan(cli.ts):
  → 被 if(!workspaceGlob) gate 住,不執行

workspaceGlob = "<agent-id>" 時:

  • "agents".includes("<agent-id>") → false → agents/ 被略過
  • Nested scan 因為 workspaceGlob 不為空,直接跳過
  • 結果:0 個檔案

建議修正

Nested agent workspace 掃描不應該被 if (!workspaceGlob) gate 住。當有明確的 workspace-glob 時,邏輯應改為:

  1. workspaceGlob 匹配到 workspace/agents/<id>/ → 掃描該 nested 路徑
  2. workspaceGlob 匹配到 workspace/<name>/ → 掃描頂層

環境

標記

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions