Rename repo-memory runtime artifacts

This commit is contained in:
2026-03-20 15:07:38 +08:00
parent 4a324d841e
commit 4f3b4a2b67
10 changed files with 54 additions and 54 deletions
@@ -10,7 +10,7 @@ import (
"strings"
"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"
)
@@ -76,7 +76,7 @@ func (s *stringSliceFlag) Set(value string) error {
func runInit(args []string) error {
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 {
return err
}
@@ -97,7 +97,7 @@ func runInit(args []string) error {
func runIngest(args []string) error {
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")
scanPath := fs.String("path", "docs/ai", "Relative path under repo to scan for markdown")
if err := fs.Parse(args); err != nil {
@@ -133,7 +133,7 @@ func runIngest(args []string) error {
return err
}
docs, err := brief.LoadRepo(absRepo, *scanPath)
docs, err := documents.LoadRepo(absRepo, *scanPath)
if err != nil {
return err
}
@@ -162,7 +162,7 @@ func runIngest(args []string) error {
func runAdd(args []string) error {
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")
kind := fs.String("kind", "", "Knowledge kind, e.g. term|chain|danger")
key := fs.String("key", "", "Stable entry key")
@@ -243,7 +243,7 @@ func runAdd(args []string) error {
func runSearch(args []string) error {
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")
repo := fs.String("repo", "", "Optional repo path filter (substring match)")
limit := fs.Int("limit", 10, "Result limit")
@@ -283,7 +283,7 @@ func runSearch(args []string) error {
func runRepos(args []string) error {
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 {
return err
}
@@ -311,7 +311,7 @@ func runRepos(args []string) error {
func runList(args []string) error {
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)")
kind := fs.String("kind", "", "Optional knowledge kind filter")
status := fs.String("status", "", "Optional status filter")
@@ -349,7 +349,7 @@ func runList(args []string) error {
func runEvents(args []string) error {
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")
repo := fs.String("repo", "", "Repo root 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 {
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")
toID := fs.Int64("to-id", 0, "To entry id")
relation := fs.String("relation", "", "Link relation")
@@ -422,7 +422,7 @@ func runLink(args []string) error {
func runVerify(args []string) error {
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")
if err := fs.Parse(args); err != nil {
return err
@@ -501,18 +501,18 @@ func runVerify(args []string) error {
}
func usage() {
fmt.Fprintf(os.Stderr, `briefdb: repo memory CLI
fmt.Fprintf(os.Stderr, `repo-memory: repo memory CLI
Usage:
briefdb init --db briefs.db
briefdb add --db briefs.db --repo /path/to/repo --kind term --key AITask --summary "..."
briefdb ingest --db briefs.db --repo /path/to/repo [--path docs/ai]
briefdb search --db briefs.db --query "actionCode fill" [--repo zeus]
briefdb list --db briefs.db [--repo zeus] [--kind term] [--status confirmed]
briefdb events --db briefs.db --id 1
briefdb link --db briefs.db --from-id 1 --to-id 2 --relation related_to
briefdb verify --db briefs.db [--repo /path/to/repo]
briefdb repos --db briefs.db
repo-memory init --db repo-memory.db
repo-memory add --db repo-memory.db --repo /path/to/repo --kind term --key AITask --summary "..."
repo-memory ingest --db repo-memory.db --repo /path/to/repo [--path docs/ai]
repo-memory search --db repo-memory.db --query "actionCode fill" [--repo zeus]
repo-memory list --db repo-memory.db [--repo zeus] [--kind term] [--status confirmed]
repo-memory events --db repo-memory.db --id 1
repo-memory link --db repo-memory.db --from-id 1 --to-id 2 --relation related_to
repo-memory verify --db repo-memory.db [--repo /path/to/repo]
repo-memory repos --db repo-memory.db
`)
}
@@ -1,4 +1,4 @@
package brief
package documents
import (
"crypto/sha256"
@@ -1,4 +1,4 @@
package brief
package documents
import (
"os"
@@ -16,14 +16,14 @@ func TestParseFile(t *testing.T) {
t.Fatal(err)
}
file := filepath.Join(path, "repo-brief.md")
file := filepath.Join(path, "repo-memory.md")
content := strings.TrimSpace(`
---
title: Zeus Repo Brief
title: Zeus Repo Memory
repo: zeus
---
# Repo Brief
# Repo Memory
Intro text.
@@ -45,10 +45,10 @@ Intro text.
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)
}
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)
}
if len(doc.Sections) != 3 {
@@ -9,7 +9,7 @@ import (
"strings"
"time"
"ai-workflow-skill/packages/repo-memory-runtime/internal/brief"
"ai-workflow-skill/packages/repo-memory-runtime/internal/documents"
_ "github.com/mattn/go-sqlite3"
)
@@ -421,7 +421,7 @@ func (s *Store) UpsertEntry(ctx context.Context, in EntryInput) (int64, error) {
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
if _, err := s.UpsertRepo(ctx, repoState); err != nil {
return err
@@ -759,7 +759,7 @@ func classifyImportedKind(docKind, heading string) string {
return "term"
case "playbooks":
return "entry"
case "repo-brief":
case "repo-memory", "repo-brief":
switch {
case strings.Contains(lowerHeading, "module"):
return "module"
@@ -5,13 +5,13 @@ import (
"path/filepath"
"testing"
"ai-workflow-skill/packages/repo-memory-runtime/internal/brief"
"ai-workflow-skill/packages/repo-memory-runtime/internal/documents"
)
func TestImportDocumentAndSearch(t *testing.T) {
t.Parallel()
dbPath := filepath.Join(t.TempDir(), "briefs.db")
dbPath := filepath.Join(t.TempDir(), "repo-memory.db")
st, err := Open(dbPath)
if err != nil {
t.Fatal(err)
@@ -23,14 +23,14 @@ func TestImportDocumentAndSearch(t *testing.T) {
t.Fatal(err)
}
doc := brief.Document{
doc := documents.Document{
RepoPath: "/tmp/zeus",
DocPath: "docs/ai/repo-brief.md",
Kind: "repo-brief",
Title: "Zeus Repo Brief",
DocPath: "docs/ai/repo-memory.md",
Kind: "repo-memory",
Title: "Zeus Repo Memory",
Hash: "abc",
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: "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) {
t.Parallel()
dbPath := filepath.Join(t.TempDir(), "briefs.db")
dbPath := filepath.Join(t.TempDir(), "repo-memory.db")
st, err := Open(dbPath)
if err != nil {
t.Fatal(err)
@@ -178,7 +178,7 @@ func TestUpsertEntryWithAliasesAndDependencies(t *testing.T) {
func TestApplyVerificationResult(t *testing.T) {
t.Parallel()
dbPath := filepath.Join(t.TempDir(), "briefs.db")
dbPath := filepath.Join(t.TempDir(), "repo-memory.db")
st, err := Open(dbPath)
if err != nil {
t.Fatal(err)