Rename repo-memory runtime artifacts
This commit is contained in:
+21
-21
@@ -10,7 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"ai-workflow-skill/packages/repo-memory-runtime/internal/brief"
|
"ai-workflow-skill/packages/repo-memory-runtime/internal/documents"
|
||||||
"ai-workflow-skill/packages/repo-memory-runtime/internal/store"
|
"ai-workflow-skill/packages/repo-memory-runtime/internal/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ func (s *stringSliceFlag) Set(value string) error {
|
|||||||
|
|
||||||
func runInit(args []string) error {
|
func runInit(args []string) error {
|
||||||
fs := flag.NewFlagSet("init", flag.ContinueOnError)
|
fs := flag.NewFlagSet("init", flag.ContinueOnError)
|
||||||
dbPath := fs.String("db", "briefs.db", "SQLite database path")
|
dbPath := fs.String("db", "repo-memory.db", "SQLite database path")
|
||||||
if err := fs.Parse(args); err != nil {
|
if err := fs.Parse(args); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ func runInit(args []string) error {
|
|||||||
|
|
||||||
func runIngest(args []string) error {
|
func runIngest(args []string) error {
|
||||||
fs := flag.NewFlagSet("ingest", flag.ContinueOnError)
|
fs := flag.NewFlagSet("ingest", flag.ContinueOnError)
|
||||||
dbPath := fs.String("db", "briefs.db", "SQLite database path")
|
dbPath := fs.String("db", "repo-memory.db", "SQLite database path")
|
||||||
repoPath := fs.String("repo", "", "Repository root")
|
repoPath := fs.String("repo", "", "Repository root")
|
||||||
scanPath := fs.String("path", "docs/ai", "Relative path under repo to scan for markdown")
|
scanPath := fs.String("path", "docs/ai", "Relative path under repo to scan for markdown")
|
||||||
if err := fs.Parse(args); err != nil {
|
if err := fs.Parse(args); err != nil {
|
||||||
@@ -133,7 +133,7 @@ func runIngest(args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
docs, err := brief.LoadRepo(absRepo, *scanPath)
|
docs, err := documents.LoadRepo(absRepo, *scanPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ func runIngest(args []string) error {
|
|||||||
|
|
||||||
func runAdd(args []string) error {
|
func runAdd(args []string) error {
|
||||||
fs := flag.NewFlagSet("add", flag.ContinueOnError)
|
fs := flag.NewFlagSet("add", flag.ContinueOnError)
|
||||||
dbPath := fs.String("db", "briefs.db", "SQLite database path")
|
dbPath := fs.String("db", "repo-memory.db", "SQLite database path")
|
||||||
repoPath := fs.String("repo", "", "Repository root")
|
repoPath := fs.String("repo", "", "Repository root")
|
||||||
kind := fs.String("kind", "", "Knowledge kind, e.g. term|chain|danger")
|
kind := fs.String("kind", "", "Knowledge kind, e.g. term|chain|danger")
|
||||||
key := fs.String("key", "", "Stable entry key")
|
key := fs.String("key", "", "Stable entry key")
|
||||||
@@ -243,7 +243,7 @@ func runAdd(args []string) error {
|
|||||||
|
|
||||||
func runSearch(args []string) error {
|
func runSearch(args []string) error {
|
||||||
fs := flag.NewFlagSet("search", flag.ContinueOnError)
|
fs := flag.NewFlagSet("search", flag.ContinueOnError)
|
||||||
dbPath := fs.String("db", "briefs.db", "SQLite database path")
|
dbPath := fs.String("db", "repo-memory.db", "SQLite database path")
|
||||||
query := fs.String("query", "", "Search query")
|
query := fs.String("query", "", "Search query")
|
||||||
repo := fs.String("repo", "", "Optional repo path filter (substring match)")
|
repo := fs.String("repo", "", "Optional repo path filter (substring match)")
|
||||||
limit := fs.Int("limit", 10, "Result limit")
|
limit := fs.Int("limit", 10, "Result limit")
|
||||||
@@ -283,7 +283,7 @@ func runSearch(args []string) error {
|
|||||||
|
|
||||||
func runRepos(args []string) error {
|
func runRepos(args []string) error {
|
||||||
fs := flag.NewFlagSet("repos", flag.ContinueOnError)
|
fs := flag.NewFlagSet("repos", flag.ContinueOnError)
|
||||||
dbPath := fs.String("db", "briefs.db", "SQLite database path")
|
dbPath := fs.String("db", "repo-memory.db", "SQLite database path")
|
||||||
if err := fs.Parse(args); err != nil {
|
if err := fs.Parse(args); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ func runRepos(args []string) error {
|
|||||||
|
|
||||||
func runList(args []string) error {
|
func runList(args []string) error {
|
||||||
fs := flag.NewFlagSet("list", flag.ContinueOnError)
|
fs := flag.NewFlagSet("list", flag.ContinueOnError)
|
||||||
dbPath := fs.String("db", "briefs.db", "SQLite database path")
|
dbPath := fs.String("db", "repo-memory.db", "SQLite database path")
|
||||||
repo := fs.String("repo", "", "Optional repo path filter (substring match)")
|
repo := fs.String("repo", "", "Optional repo path filter (substring match)")
|
||||||
kind := fs.String("kind", "", "Optional knowledge kind filter")
|
kind := fs.String("kind", "", "Optional knowledge kind filter")
|
||||||
status := fs.String("status", "", "Optional status filter")
|
status := fs.String("status", "", "Optional status filter")
|
||||||
@@ -349,7 +349,7 @@ func runList(args []string) error {
|
|||||||
|
|
||||||
func runEvents(args []string) error {
|
func runEvents(args []string) error {
|
||||||
fs := flag.NewFlagSet("events", flag.ContinueOnError)
|
fs := flag.NewFlagSet("events", flag.ContinueOnError)
|
||||||
dbPath := fs.String("db", "briefs.db", "SQLite database path")
|
dbPath := fs.String("db", "repo-memory.db", "SQLite database path")
|
||||||
id := fs.Int64("id", 0, "Entry id")
|
id := fs.Int64("id", 0, "Entry id")
|
||||||
repo := fs.String("repo", "", "Repo root when resolving by kind/key")
|
repo := fs.String("repo", "", "Repo root when resolving by kind/key")
|
||||||
kind := fs.String("kind", "", "Knowledge kind when resolving by kind/key")
|
kind := fs.String("kind", "", "Knowledge kind when resolving by kind/key")
|
||||||
@@ -398,7 +398,7 @@ func runEvents(args []string) error {
|
|||||||
|
|
||||||
func runLink(args []string) error {
|
func runLink(args []string) error {
|
||||||
fs := flag.NewFlagSet("link", flag.ContinueOnError)
|
fs := flag.NewFlagSet("link", flag.ContinueOnError)
|
||||||
dbPath := fs.String("db", "briefs.db", "SQLite database path")
|
dbPath := fs.String("db", "repo-memory.db", "SQLite database path")
|
||||||
fromID := fs.Int64("from-id", 0, "From entry id")
|
fromID := fs.Int64("from-id", 0, "From entry id")
|
||||||
toID := fs.Int64("to-id", 0, "To entry id")
|
toID := fs.Int64("to-id", 0, "To entry id")
|
||||||
relation := fs.String("relation", "", "Link relation")
|
relation := fs.String("relation", "", "Link relation")
|
||||||
@@ -422,7 +422,7 @@ func runLink(args []string) error {
|
|||||||
|
|
||||||
func runVerify(args []string) error {
|
func runVerify(args []string) error {
|
||||||
fs := flag.NewFlagSet("verify", flag.ContinueOnError)
|
fs := flag.NewFlagSet("verify", flag.ContinueOnError)
|
||||||
dbPath := fs.String("db", "briefs.db", "SQLite database path")
|
dbPath := fs.String("db", "repo-memory.db", "SQLite database path")
|
||||||
repo := fs.String("repo", "", "Optional repo root to verify; if omitted, verify all known repos")
|
repo := fs.String("repo", "", "Optional repo root to verify; if omitted, verify all known repos")
|
||||||
if err := fs.Parse(args); err != nil {
|
if err := fs.Parse(args); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -501,18 +501,18 @@ func runVerify(args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
fmt.Fprintf(os.Stderr, `briefdb: repo memory CLI
|
fmt.Fprintf(os.Stderr, `repo-memory: repo memory CLI
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
briefdb init --db briefs.db
|
repo-memory init --db repo-memory.db
|
||||||
briefdb add --db briefs.db --repo /path/to/repo --kind term --key AITask --summary "..."
|
repo-memory add --db repo-memory.db --repo /path/to/repo --kind term --key AITask --summary "..."
|
||||||
briefdb ingest --db briefs.db --repo /path/to/repo [--path docs/ai]
|
repo-memory ingest --db repo-memory.db --repo /path/to/repo [--path docs/ai]
|
||||||
briefdb search --db briefs.db --query "actionCode fill" [--repo zeus]
|
repo-memory search --db repo-memory.db --query "actionCode fill" [--repo zeus]
|
||||||
briefdb list --db briefs.db [--repo zeus] [--kind term] [--status confirmed]
|
repo-memory list --db repo-memory.db [--repo zeus] [--kind term] [--status confirmed]
|
||||||
briefdb events --db briefs.db --id 1
|
repo-memory events --db repo-memory.db --id 1
|
||||||
briefdb link --db briefs.db --from-id 1 --to-id 2 --relation related_to
|
repo-memory link --db repo-memory.db --from-id 1 --to-id 2 --relation related_to
|
||||||
briefdb verify --db briefs.db [--repo /path/to/repo]
|
repo-memory verify --db repo-memory.db [--repo /path/to/repo]
|
||||||
briefdb repos --db briefs.db
|
repo-memory repos --db repo-memory.db
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package brief
|
package documents
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
+6
-6
@@ -1,4 +1,4 @@
|
|||||||
package brief
|
package documents
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
@@ -16,14 +16,14 @@ func TestParseFile(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
file := filepath.Join(path, "repo-brief.md")
|
file := filepath.Join(path, "repo-memory.md")
|
||||||
content := strings.TrimSpace(`
|
content := strings.TrimSpace(`
|
||||||
---
|
---
|
||||||
title: Zeus Repo Brief
|
title: Zeus Repo Memory
|
||||||
repo: zeus
|
repo: zeus
|
||||||
---
|
---
|
||||||
|
|
||||||
# Repo Brief
|
# Repo Memory
|
||||||
|
|
||||||
Intro text.
|
Intro text.
|
||||||
|
|
||||||
@@ -45,10 +45,10 @@ Intro text.
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if got, want := doc.Title, "Zeus Repo Brief"; got != want {
|
if got, want := doc.Title, "Zeus Repo Memory"; got != want {
|
||||||
t.Fatalf("title = %q, want %q", got, want)
|
t.Fatalf("title = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
if got, want := doc.DocPath, "docs/ai/repo-brief.md"; got != want {
|
if got, want := doc.DocPath, "docs/ai/repo-memory.md"; got != want {
|
||||||
t.Fatalf("doc path = %q, want %q", got, want)
|
t.Fatalf("doc path = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
if len(doc.Sections) != 3 {
|
if len(doc.Sections) != 3 {
|
||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"ai-workflow-skill/packages/repo-memory-runtime/internal/brief"
|
"ai-workflow-skill/packages/repo-memory-runtime/internal/documents"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -421,7 +421,7 @@ func (s *Store) UpsertEntry(ctx context.Context, in EntryInput) (int64, error) {
|
|||||||
return entryID, tx.Commit()
|
return entryID, tx.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Store) ImportDocument(ctx context.Context, doc brief.Document, repoState RepoState) error {
|
func (s *Store) ImportDocument(ctx context.Context, doc documents.Document, repoState RepoState) error {
|
||||||
repoState.RootPath = doc.RepoPath
|
repoState.RootPath = doc.RepoPath
|
||||||
if _, err := s.UpsertRepo(ctx, repoState); err != nil {
|
if _, err := s.UpsertRepo(ctx, repoState); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -759,7 +759,7 @@ func classifyImportedKind(docKind, heading string) string {
|
|||||||
return "term"
|
return "term"
|
||||||
case "playbooks":
|
case "playbooks":
|
||||||
return "entry"
|
return "entry"
|
||||||
case "repo-brief":
|
case "repo-memory", "repo-brief":
|
||||||
switch {
|
switch {
|
||||||
case strings.Contains(lowerHeading, "module"):
|
case strings.Contains(lowerHeading, "module"):
|
||||||
return "module"
|
return "module"
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"ai-workflow-skill/packages/repo-memory-runtime/internal/brief"
|
"ai-workflow-skill/packages/repo-memory-runtime/internal/documents"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestImportDocumentAndSearch(t *testing.T) {
|
func TestImportDocumentAndSearch(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
dbPath := filepath.Join(t.TempDir(), "briefs.db")
|
dbPath := filepath.Join(t.TempDir(), "repo-memory.db")
|
||||||
st, err := Open(dbPath)
|
st, err := Open(dbPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -23,14 +23,14 @@ func TestImportDocumentAndSearch(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
doc := brief.Document{
|
doc := documents.Document{
|
||||||
RepoPath: "/tmp/zeus",
|
RepoPath: "/tmp/zeus",
|
||||||
DocPath: "docs/ai/repo-brief.md",
|
DocPath: "docs/ai/repo-memory.md",
|
||||||
Kind: "repo-brief",
|
Kind: "repo-memory",
|
||||||
Title: "Zeus Repo Brief",
|
Title: "Zeus Repo Memory",
|
||||||
Hash: "abc",
|
Hash: "abc",
|
||||||
Metadata: map[string]string{"repo": "zeus"},
|
Metadata: map[string]string{"repo": "zeus"},
|
||||||
Sections: []brief.Section{
|
Sections: []documents.Section{
|
||||||
{Heading: "Module Map", Level: 2, Ordinal: 1, Body: "AI insight lives in app/app and gateway."},
|
{Heading: "Module Map", Level: 2, Ordinal: 1, Body: "AI insight lives in app/app and gateway."},
|
||||||
{Heading: "Danger Zones", Level: 2, Ordinal: 2, Body: "Avoid shared libs first."},
|
{Heading: "Danger Zones", Level: 2, Ordinal: 2, Body: "Avoid shared libs first."},
|
||||||
},
|
},
|
||||||
@@ -67,7 +67,7 @@ func TestImportDocumentAndSearch(t *testing.T) {
|
|||||||
func TestUpsertEntryWithAliasesAndDependencies(t *testing.T) {
|
func TestUpsertEntryWithAliasesAndDependencies(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
dbPath := filepath.Join(t.TempDir(), "briefs.db")
|
dbPath := filepath.Join(t.TempDir(), "repo-memory.db")
|
||||||
st, err := Open(dbPath)
|
st, err := Open(dbPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -178,7 +178,7 @@ func TestUpsertEntryWithAliasesAndDependencies(t *testing.T) {
|
|||||||
func TestApplyVerificationResult(t *testing.T) {
|
func TestApplyVerificationResult(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
dbPath := filepath.Join(t.TempDir(), "briefs.db")
|
dbPath := filepath.Join(t.TempDir(), "repo-memory.db")
|
||||||
st, err := Open(dbPath)
|
st, err := Open(dbPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
"skill": "repo-memory",
|
"skill": "repo-memory",
|
||||||
"type": "go-binary",
|
"type": "go-binary",
|
||||||
"runtimePackage": "./packages/repo-memory-runtime",
|
"runtimePackage": "./packages/repo-memory-runtime",
|
||||||
"entrypoint": "./packages/repo-memory-runtime/cmd/briefdb",
|
"entrypoint": "./packages/repo-memory-runtime/cmd/repo-memory",
|
||||||
"output": "skills/repo-memory/assets/briefdb",
|
"output": "skills/repo-memory/assets/repo-memory",
|
||||||
"buildState": "ready"
|
"buildState": "ready"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+11
-11
@@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
name: repo-memory
|
name: repo-memory
|
||||||
description: Durable repository memory through a bundled briefdb CLI. Use when an agent needs to search prior project knowledge, ingest curated docs, record confirmed repository facts, inspect knowledge history, or verify whether stored knowledge may have gone stale in a local SQLite memory database instead of rediscovering the same repository context from scratch.
|
description: Durable repository memory through a bundled repo-memory CLI. Use when an agent needs to search prior project knowledge, ingest curated docs, record confirmed repository facts, inspect knowledge history, or verify whether stored knowledge may have gone stale in a local SQLite memory database instead of rediscovering the same repository context from scratch.
|
||||||
---
|
---
|
||||||
|
|
||||||
# Repo Memory
|
# Repo Memory
|
||||||
|
|
||||||
Use the bundled `./assets/briefdb` CLI to maintain and query durable repository memory.
|
Use the bundled `./assets/repo-memory` CLI to maintain and query durable repository memory.
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
- Invoke `./assets/briefdb` relative to this skill directory.
|
- Invoke `./assets/repo-memory` relative to this skill directory.
|
||||||
- Default database path: `~/.codex/data/repo-memory.db`.
|
- Default database path: `~/.codex/data/repo-memory.db`.
|
||||||
- Prefer searching before a deep repo dive so repeated work starts from existing knowledge.
|
- Prefer searching before a deep repo dive so repeated work starts from existing knowledge.
|
||||||
- Run `init` before first use on a new database path.
|
- Run `init` before first use on a new database path.
|
||||||
@@ -25,14 +25,14 @@ Use the bundled `./assets/briefdb` CLI to maintain and query durable repository
|
|||||||
## Typical Commands
|
## Typical Commands
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./assets/briefdb init --db ~/.codex/data/repo-memory.db
|
./assets/repo-memory init --db ~/.codex/data/repo-memory.db
|
||||||
./assets/briefdb search --db ~/.codex/data/repo-memory.db --repo zeus --query "ai insight fill"
|
./assets/repo-memory search --db ~/.codex/data/repo-memory.db --repo zeus --query "ai insight fill"
|
||||||
./assets/briefdb ingest --db ~/.codex/data/repo-memory.db --repo /Users/xd/java/zeus
|
./assets/repo-memory ingest --db ~/.codex/data/repo-memory.db --repo /Users/xd/java/zeus
|
||||||
./assets/briefdb add --db ~/.codex/data/repo-memory.db --repo /Users/xd/java/zeus --kind term --key AITask --summary "Plan 内嵌任务结构,不是独立表" --source-path /Users/xd/java/zeus/app/app/src/main/java/foo/AITask.java --source-line 42 --status confirmed --alias "AI Task" --dep file:/Users/xd/java/zeus/app/app/src/main/java/foo/AITask.java:hard
|
./assets/repo-memory add --db ~/.codex/data/repo-memory.db --repo /Users/xd/java/zeus --kind term --key AITask --summary "Plan 内嵌任务结构,不是独立表" --source-path /Users/xd/java/zeus/app/app/src/main/java/foo/AITask.java --source-line 42 --status confirmed --alias "AI Task" --dep file:/Users/xd/java/zeus/app/app/src/main/java/foo/AITask.java:hard
|
||||||
./assets/briefdb list --db ~/.codex/data/repo-memory.db --repo zeus --kind term
|
./assets/repo-memory list --db ~/.codex/data/repo-memory.db --repo zeus --kind term
|
||||||
./assets/briefdb events --db ~/.codex/data/repo-memory.db --id 1
|
./assets/repo-memory events --db ~/.codex/data/repo-memory.db --id 1
|
||||||
./assets/briefdb verify --db ~/.codex/data/repo-memory.db --repo /Users/xd/java/zeus
|
./assets/repo-memory verify --db ~/.codex/data/repo-memory.db --repo /Users/xd/java/zeus
|
||||||
./assets/briefdb repos --db ~/.codex/data/repo-memory.db
|
./assets/repo-memory repos --db ~/.codex/data/repo-memory.db
|
||||||
```
|
```
|
||||||
|
|
||||||
## Command Map
|
## Command Map
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
interface:
|
interface:
|
||||||
display_name: "Repo Memory CLI"
|
display_name: "Repo Memory CLI"
|
||||||
short_description: "Durable repository knowledge base"
|
short_description: "Durable repository knowledge base"
|
||||||
default_prompt: "Use $repo-memory to search or record durable project knowledge through the bundled briefdb CLI and a local SQLite memory database."
|
default_prompt: "Use $repo-memory to search or record durable project knowledge through the bundled repo-memory CLI and a local SQLite memory database."
|
||||||
|
|
||||||
policy:
|
policy:
|
||||||
allow_implicit_invocation: true
|
allow_implicit_invocation: true
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user