feat: enhance profile path resolution and add example profiles for better project adaptability
This commit is contained in:
@@ -175,7 +175,7 @@ class ContextMCPTests(unittest.TestCase):
|
||||
}) + "\n", encoding="utf-8")
|
||||
manifest.write_text(json.dumps({"chunk_count": 1}), encoding="utf-8")
|
||||
|
||||
with patch.object(server, "ROOT", root), patch.object(server, "INDEX_ROOT", root / ".aiw" / "indexes"):
|
||||
with patch.object(server, "ROOT", root):
|
||||
result = server.memory_hybrid_search({"profile": "fidelity", "query": "dismissal lifecycle"})["structuredContent"]
|
||||
|
||||
self.assertTrue(result["index_available"])
|
||||
@@ -189,13 +189,31 @@ class ContextMCPTests(unittest.TestCase):
|
||||
real.parent.mkdir(parents=True)
|
||||
real.write_text("Important XFlow context", encoding="utf-8")
|
||||
|
||||
with patch.object(server, "ROOT", root), patch.object(server, "INDEX_ROOT", root / ".aiw" / "indexes"):
|
||||
with patch.object(server, "ROOT", root):
|
||||
result = server.memory_hybrid_search({"profile": "fidelity", "query": "XFlow"})["structuredContent"]
|
||||
|
||||
self.assertFalse(result["index_available"])
|
||||
self.assertEqual(result["source"], "live-project-knowledge-fallback")
|
||||
self.assertEqual(len(result["matches"]), 1)
|
||||
|
||||
def test_project_context_uses_workspace_json_paths(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
config = root / "profiles" / "demo" / "workspace.json"
|
||||
current = root / "workspaces" / "demo" / "project-knowledge" / "01-current" / "current-work.md"
|
||||
work_items = root / "workspaces" / "demo" / "project-knowledge" / "01-current" / "work-items.md"
|
||||
config.parent.mkdir(parents=True)
|
||||
current.parent.mkdir(parents=True)
|
||||
config.write_text(json.dumps({"knowledge_dir": "workspaces/demo/project-knowledge"}), encoding="utf-8")
|
||||
current.write_text("# Current\nDemo current work", encoding="utf-8")
|
||||
work_items.write_text("# Work Items", encoding="utf-8")
|
||||
|
||||
with patch.object(server, "ROOT", root):
|
||||
result = server.project_current_context({"profile": "demo"})["structuredContent"]
|
||||
|
||||
self.assertEqual(result["files"][0]["path"], "workspaces/demo/project-knowledge/01-current/current-work.md")
|
||||
self.assertIn("Demo current work", result["files"][0]["text"])
|
||||
|
||||
def test_previous_workday_skips_weekend(self) -> None:
|
||||
monday = date(2026, 5, 18)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user