@shahmilsaari/memory-core 0.2.8 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +221 -58
- package/dist/chunk-73SRPNAL.js +196 -0
- package/dist/chunk-HAGRPKR3.js +30 -0
- package/dist/chunk-KSLFLWB4.js +32 -0
- package/dist/cli.js +935 -386
- package/dist/db-KU4EEG4Y.js +28 -0
- package/dist/embedding-PAYD2JYW.js +8 -0
- package/package.json +4 -2
- package/profiles/go-api.yml +43 -0
- package/profiles/nextjs.yml +0 -32
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
closePool,
|
|
4
|
+
deleteMemory,
|
|
5
|
+
getMemory,
|
|
6
|
+
getPool,
|
|
7
|
+
hashMemoryContent,
|
|
8
|
+
listMemories,
|
|
9
|
+
runMigrations,
|
|
10
|
+
saveMemory,
|
|
11
|
+
searchMemories,
|
|
12
|
+
updateMemory,
|
|
13
|
+
upsertMemory
|
|
14
|
+
} from "./chunk-73SRPNAL.js";
|
|
15
|
+
import "./chunk-KSLFLWB4.js";
|
|
16
|
+
export {
|
|
17
|
+
closePool,
|
|
18
|
+
deleteMemory,
|
|
19
|
+
getMemory,
|
|
20
|
+
getPool,
|
|
21
|
+
hashMemoryContent,
|
|
22
|
+
listMemories,
|
|
23
|
+
runMigrations,
|
|
24
|
+
saveMemory,
|
|
25
|
+
searchMemories,
|
|
26
|
+
updateMemory,
|
|
27
|
+
upsertMemory
|
|
28
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shahmilsaari/memory-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Universal AI memory core — generate AI context files from architecture profiles with RAG support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "tsup",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
16
17
|
"dev": "tsx src/cli.ts",
|
|
17
|
-
"start": "node dist/cli.js"
|
|
18
|
+
"start": "node dist/cli.js",
|
|
19
|
+
"test": "node --import tsx --test test/**/*.test.ts"
|
|
18
20
|
},
|
|
19
21
|
"dependencies": {
|
|
20
22
|
"@inquirer/prompts": "^5.0.0",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: go-api
|
|
2
|
+
displayName: Go REST API
|
|
3
|
+
layer: backend
|
|
4
|
+
description: Go REST API with clean package structure, idiomatic error handling, and testability
|
|
5
|
+
|
|
6
|
+
rules:
|
|
7
|
+
- Organize code into cmd/, internal/, and pkg/ — cmd/ holds main packages, internal/ holds private packages, pkg/ holds public packages
|
|
8
|
+
- HTTP handlers are thin — parse request, call service, write response. No business logic.
|
|
9
|
+
- Services own all business logic — they accept and return domain types, not HTTP types
|
|
10
|
+
- Always pass context.Context as the first parameter for cancellation and deadline propagation
|
|
11
|
+
- Return errors explicitly — never panic in library or service code. Reserve panic only for unrecoverable startup failures.
|
|
12
|
+
- Wrap errors with context using fmt.Errorf("operation: %w", err) to preserve the original error
|
|
13
|
+
- Define small, single-method interfaces at the point of use, not at the point of implementation
|
|
14
|
+
- Use struct-based request/response types for all handler inputs and outputs
|
|
15
|
+
- Validate all incoming request data before passing to the service layer
|
|
16
|
+
- Configuration comes from environment variables — use a dedicated Config struct loaded at startup with validation
|
|
17
|
+
- Use structured logging (slog or zerolog) — never log with fmt.Println in production code
|
|
18
|
+
- Implement graceful shutdown — catch SIGINT/SIGTERM and drain in-flight requests before exiting
|
|
19
|
+
- Use table-driven tests with t.Run() for all unit tests
|
|
20
|
+
- Register middleware at the router level — never call middleware logic inside handlers
|
|
21
|
+
- Database calls live in a repository layer — services never import database drivers directly
|
|
22
|
+
|
|
23
|
+
folders:
|
|
24
|
+
- cmd/api/
|
|
25
|
+
- cmd/api/main.go
|
|
26
|
+
- internal/handler/
|
|
27
|
+
- internal/service/
|
|
28
|
+
- internal/repository/
|
|
29
|
+
- internal/domain/
|
|
30
|
+
- internal/middleware/
|
|
31
|
+
- internal/config/
|
|
32
|
+
- pkg/
|
|
33
|
+
- api/
|
|
34
|
+
|
|
35
|
+
avoid:
|
|
36
|
+
- Global mutable state outside of the DI wiring in main.go
|
|
37
|
+
- Business logic inside HTTP handlers
|
|
38
|
+
- Direct database calls in service layer
|
|
39
|
+
- Ignoring returned errors (assign to _ only when truly safe)
|
|
40
|
+
- Naked returns in functions longer than a few lines
|
|
41
|
+
- Using init() for configuration — use explicit constructors instead
|
|
42
|
+
- Panicking in non-main code
|
|
43
|
+
- Mixing HTTP concerns with domain logic
|
package/profiles/nextjs.yml
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
name: nextjs
|
|
2
|
-
displayName: Next.js App Router
|
|
3
|
-
layer: fullstack
|
|
4
|
-
description: Next.js 13+ App Router with server components, server actions, and colocation
|
|
5
|
-
|
|
6
|
-
rules:
|
|
7
|
-
- Use Server Components by default — add 'use client' only when interactivity is required
|
|
8
|
-
- Data fetching happens in Server Components, not client hooks
|
|
9
|
-
- Use Server Actions for form mutations and data writes
|
|
10
|
-
- Keep page.tsx files thin — delegate to feature components
|
|
11
|
-
- Colocate components, hooks, and utilities near the route that uses them
|
|
12
|
-
- Shared UI lives in src/components/, shared logic in src/lib/
|
|
13
|
-
- API routes are for external integrations only — prefer Server Actions for internal mutations
|
|
14
|
-
- Use Route Groups to organize without affecting URL structure
|
|
15
|
-
- Environment variables exposed to client must be prefixed NEXT_PUBLIC_
|
|
16
|
-
|
|
17
|
-
folders:
|
|
18
|
-
- app/(routes)
|
|
19
|
-
- app/api
|
|
20
|
-
- src/components/ui
|
|
21
|
-
- src/components/features
|
|
22
|
-
- src/lib/utils
|
|
23
|
-
- src/lib/actions
|
|
24
|
-
- src/lib/db
|
|
25
|
-
- src/types
|
|
26
|
-
|
|
27
|
-
avoid:
|
|
28
|
-
- Data fetching in Client Components (use Server Components instead)
|
|
29
|
-
- useEffect for data loading
|
|
30
|
-
- Business logic inside page.tsx
|
|
31
|
-
- Mixing server and client code in the same file
|
|
32
|
-
- Exposing secrets via NEXT_PUBLIC_ variables
|