feat: enhance profile path resolution and add example profiles for better project adaptability
This commit is contained in:
@@ -30,7 +30,7 @@ class IndexerTests(unittest.TestCase):
|
||||
real.write_text("# XFlow\nDismissal lifecycle context", encoding="utf-8")
|
||||
template.write_text("# XFlow\nTemplate-only text", encoding="utf-8")
|
||||
|
||||
with patch.object(indexer, "ROOT", root), patch.object(indexer, "INDEX_ROOT", root / ".aiw" / "indexes"):
|
||||
with patch.object(indexer, "ROOT", root):
|
||||
manifest = indexer.write_index("fidelity")
|
||||
result = indexer.search_index("fidelity", "dismissal lifecycle", limit=5)
|
||||
|
||||
@@ -41,7 +41,7 @@ class IndexerTests(unittest.TestCase):
|
||||
def test_status_reports_unindexed_profile(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
with patch.object(indexer, "ROOT", root), patch.object(indexer, "INDEX_ROOT", root / ".aiw" / "indexes"):
|
||||
with patch.object(indexer, "ROOT", root):
|
||||
result = indexer.status("fidelity")
|
||||
|
||||
self.assertFalse(result["indexed"])
|
||||
@@ -51,6 +51,26 @@ class IndexerTests(unittest.TestCase):
|
||||
payload = {"matches": [{"path": "project-knowledge/01-current/current-work.md", "score": 1.0}]}
|
||||
self.assertIsInstance(json.dumps(payload), str)
|
||||
|
||||
def test_build_uses_workspace_json_paths(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
config = root / "profiles" / "demo" / "workspace.json"
|
||||
real = root / "workspaces" / "demo" / "project-knowledge" / "03-context" / "project.md"
|
||||
config.parent.mkdir(parents=True)
|
||||
real.parent.mkdir(parents=True)
|
||||
config.write_text(json.dumps({
|
||||
"knowledge_dir": "workspaces/demo/project-knowledge",
|
||||
"index_dir": ".aiw/indexes/demo",
|
||||
}), encoding="utf-8")
|
||||
real.write_text("# Demo\nReusable profile memory", encoding="utf-8")
|
||||
|
||||
with patch.object(indexer, "ROOT", root):
|
||||
manifest = indexer.write_index("demo")
|
||||
result = indexer.search_index("demo", "profile memory", limit=5)
|
||||
|
||||
self.assertEqual(manifest["source"], "workspaces/demo/project-knowledge")
|
||||
self.assertEqual(result["matches"][0]["path"], "workspaces/demo/project-knowledge/03-context/project.md")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user