memoryが.insomnia配下ではなくworkspace root直下を想定していた問題の修正
This commit is contained in:
@@ -174,7 +174,7 @@ mod tests {
|
||||
fn setup() -> (TempDir, WorkspaceLayout, PathBuf) {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let layout = WorkspaceLayout::new(dir.path().to_path_buf());
|
||||
let path = dir.path().join("memory/decisions/foo.md");
|
||||
let path = dir.path().join(".insomnia/memory/decisions/foo.md");
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
let initial = format!(
|
||||
"---\ncreated_at: {n}\nupdated_at: {n}\nsources: []\nstatus: open\n---\nbody body\n",
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
//! omitted, returns one entry per file (no excerpt) so the agent can
|
||||
//! enumerate what records exist without knowing what's inside them.
|
||||
//!
|
||||
//! - `MemoryQuery` walks `memory/summary.md`, `memory/decisions/`,
|
||||
//! `memory/requests/`. `memory/workflow/` and `memory/_staging/`
|
||||
//! are excluded by construction.
|
||||
//! - `KnowledgeQuery` walks `knowledge/*.md` and supports a `kind`
|
||||
//! filter against the Knowledge frontmatter's `kind` field.
|
||||
//! - `MemoryQuery` walks `.insomnia/memory/{summary.md,decisions/,
|
||||
//! requests/}`. `.insomnia/memory/workflow/` and
|
||||
//! `.insomnia/memory/_staging/` are excluded by construction.
|
||||
//! - `KnowledgeQuery` walks `.insomnia/knowledge/*.md` and supports a
|
||||
//! `kind` filter against the Knowledge frontmatter's `kind` field.
|
||||
//!
|
||||
//! No derived index — the file tree is the source of truth and is
|
||||
//! re-scanned per call. 出現順: within a file by line order, across
|
||||
@@ -441,16 +441,16 @@ mod tests {
|
||||
fn setup() -> (TempDir, WorkspaceLayout) {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let layout = WorkspaceLayout::new(dir.path().to_path_buf());
|
||||
std::fs::create_dir_all(dir.path().join("memory/decisions")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join("memory/requests")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join("memory/workflow")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join("memory/_staging")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join("knowledge")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join(".insomnia/memory/decisions")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join(".insomnia/memory/requests")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join(".insomnia/memory/workflow")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join(".insomnia/memory/_staging")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join(".insomnia/knowledge")).unwrap();
|
||||
(dir, layout)
|
||||
}
|
||||
|
||||
fn write_decision(dir: &Path, slug: &str, body: &str) {
|
||||
let path = dir.join("memory/decisions").join(format!("{slug}.md"));
|
||||
let path = dir.join(".insomnia/memory/decisions").join(format!("{slug}.md"));
|
||||
let content = format!(
|
||||
"---\ncreated_at: {n}\nupdated_at: {n}\nsources: []\nstatus: open\n---\n{body}",
|
||||
n = now()
|
||||
@@ -459,7 +459,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn write_knowledge(dir: &Path, slug: &str, kind: &str, description: &str, body: &str) {
|
||||
let path = dir.join("knowledge").join(format!("{slug}.md"));
|
||||
let path = dir.join(".insomnia/knowledge").join(format!("{slug}.md"));
|
||||
let content = format!(
|
||||
"---\ncreated_at: {n}\nupdated_at: {n}\nkind: {kind}\ndescription: \"{description}\"\nmodel_invokation: false\nuser_invocable: true\nlast_sources: []\n---\n{body}",
|
||||
n = now()
|
||||
@@ -514,7 +514,7 @@ mod tests {
|
||||
let (dir, layout) = setup();
|
||||
write_decision(dir.path(), "alpha", "body\n");
|
||||
write_decision(dir.path(), "beta", "body\n");
|
||||
let summary_path = dir.path().join("memory/summary.md");
|
||||
let summary_path = dir.path().join(".insomnia/memory/summary.md");
|
||||
std::fs::write(
|
||||
&summary_path,
|
||||
format!("---\nupdated_at: {n}\n---\nhello\n", n = now()),
|
||||
@@ -534,7 +534,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn memory_query_finds_summary() {
|
||||
let (dir, layout) = setup();
|
||||
let summary_path = dir.path().join("memory/summary.md");
|
||||
let summary_path = dir.path().join(".insomnia/memory/summary.md");
|
||||
std::fs::write(
|
||||
&summary_path,
|
||||
format!("---\nupdated_at: {n}\n---\nthe needle is here\n", n = now()),
|
||||
@@ -552,9 +552,9 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn memory_query_excludes_workflow_and_staging() {
|
||||
let (dir, layout) = setup();
|
||||
let wf = dir.path().join("memory/workflow/wf.md");
|
||||
let wf = dir.path().join(".insomnia/memory/workflow/wf.md");
|
||||
std::fs::write(&wf, "needle in workflow\n").unwrap();
|
||||
let stg = dir.path().join("memory/_staging/abc.json");
|
||||
let stg = dir.path().join(".insomnia/memory/_staging/abc.json");
|
||||
std::fs::write(&stg, "needle in staging\n").unwrap();
|
||||
|
||||
let (_, tool) = memory_query_tool(layout, QueryConfig::default())();
|
||||
|
||||
@@ -144,7 +144,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn read_decision_by_slug() {
|
||||
let (dir, layout) = setup();
|
||||
let path = dir.path().join("memory/decisions/foo.md");
|
||||
let path = dir.path().join(".insomnia/memory/decisions/foo.md");
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
std::fs::write(&path, "alpha\nbeta\n").unwrap();
|
||||
|
||||
@@ -159,7 +159,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn read_summary_without_slug() {
|
||||
let (dir, layout) = setup();
|
||||
let path = dir.path().join("memory/summary.md");
|
||||
let path = dir.path().join(".insomnia/memory/summary.md");
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
std::fs::write(&path, "summary body\n").unwrap();
|
||||
|
||||
@@ -199,7 +199,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn knowledge_path_resolution() {
|
||||
let (dir, layout) = setup();
|
||||
let path = dir.path().join("knowledge/policy.md");
|
||||
let path = dir.path().join(".insomnia/knowledge/policy.md");
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
std::fs::write(&path, "k\n").unwrap();
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn write_creates_summary() {
|
||||
let (dir, layout) = setup();
|
||||
let path = dir.path().join("memory/summary.md");
|
||||
let path = dir.path().join(".insomnia/memory/summary.md");
|
||||
let content = format!("---\nupdated_at: {n}\n---\nbody\n", n = now());
|
||||
|
||||
let (meta, tool) = write_tool(layout)();
|
||||
@@ -187,7 +187,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn write_update_existing() {
|
||||
let (dir, layout) = setup();
|
||||
let path = dir.path().join("memory/decisions/foo.md");
|
||||
let path = dir.path().join(".insomnia/memory/decisions/foo.md");
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
let initial = format!(
|
||||
"---\ncreated_at: {n}\nupdated_at: {n}\nsources: []\nstatus: open\n---\nold\n",
|
||||
@@ -220,7 +220,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn write_does_not_persist_on_lint_failure() {
|
||||
let (dir, layout) = setup();
|
||||
let path = dir.path().join("memory/decisions/foo.md");
|
||||
let path = dir.path().join(".insomnia/memory/decisions/foo.md");
|
||||
let bad = "no frontmatter at all";
|
||||
let (_, tool) = write_tool(layout)();
|
||||
let inp = serde_json::json!({
|
||||
|
||||
Reference in New Issue
Block a user