@shahmilsaari/memory-core 1.0.22 → 1.0.26
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 +75 -868
- package/dist/approval-queue-YBYRGBHP.js +7 -0
- package/dist/ast-analyzer-JM4CIOFY.js +44 -0
- package/dist/check-cache-6NWRTZJD.js +52 -0
- package/dist/check-logger-5HYSWA3S.js +21 -0
- package/dist/{chunk-UZDALJVQ.js → chunk-3XTHE74V.js} +2488 -1461
- package/dist/chunk-M7NKSXFS.js +301 -0
- package/dist/chunk-PQBWHAZN.js +156 -0
- package/dist/chunk-W6WEAV3S.js +69 -0
- package/dist/chunk-ZZBQEXEO.js +183 -0
- package/dist/classifier-MZ65R7FK.js +60 -0
- package/dist/cli.js +868 -1585
- package/dist/confidence-gate-ZQDAOS6P.js +64 -0
- package/dist/dashboard/assets/index-CE3AMEOD.js +2 -0
- package/dist/dashboard/assets/{index-DXXHB1Ik.css → index-CNc2vvZF.css} +1 -1
- package/dist/dashboard/index.html +2 -2
- package/dist/{dashboard-server-VOT2ZRVN.js → dashboard-server-EEFNE6NX.js} +161 -14
- package/dist/db-PRDHI2CN.js +29 -0
- package/dist/deepseek-critique-MALVIYGF.js +82 -0
- package/dist/deterministic-validator-PP56B46I.js +18 -0
- package/dist/evidence-HVMSONTT.js +65 -0
- package/dist/graph-TFNTB5OK.js +98 -0
- package/dist/incident-capture-RVPZULS7.js +20 -0
- package/dist/ollama-judge-D2LFK5PB.js +137 -0
- package/dist/rate-limiter-SLIPCXRF.js +41 -0
- package/dist/rules-V3QMN3AR.js +95 -0
- package/dist/watch-errors-B3FA26N4.js +99 -0
- package/package.json +1 -1
- package/dist/dashboard/assets/index-BRqvIBnm.js +0 -2
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/classifier.ts
|
|
4
|
+
import { existsSync, readFileSync } from "fs";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
function globToRegex(pattern) {
|
|
7
|
+
const escaped = pattern.replace(/\./g, "\\.").replace(/\*\*\//g, "(?:.+/)?").replace(/\*\*/g, ".+").replace(/\*/g, "[^/]+");
|
|
8
|
+
return new RegExp(`^${escaped}`);
|
|
9
|
+
}
|
|
10
|
+
function matchesGlob(filepath, pattern) {
|
|
11
|
+
return globToRegex(pattern).test(filepath);
|
|
12
|
+
}
|
|
13
|
+
var FileClassifier = class _FileClassifier {
|
|
14
|
+
constructor(layers) {
|
|
15
|
+
this.layers = layers;
|
|
16
|
+
}
|
|
17
|
+
layers;
|
|
18
|
+
classifyFile(filepath) {
|
|
19
|
+
const normalized = filepath.replace(/\\/g, "/");
|
|
20
|
+
for (const layer of this.layers) {
|
|
21
|
+
if (layer.paths.some((p) => matchesGlob(normalized, p))) {
|
|
22
|
+
return { file: filepath, layer: layer.name, isNew: false, isModified: false };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
classifyDiff(diff) {
|
|
28
|
+
const result = [];
|
|
29
|
+
for (const file of diff.added) {
|
|
30
|
+
const c = this.classifyFile(file);
|
|
31
|
+
if (c) result.push({ ...c, isNew: true });
|
|
32
|
+
}
|
|
33
|
+
for (const file of diff.modified) {
|
|
34
|
+
const c = this.classifyFile(file);
|
|
35
|
+
if (c) result.push({ ...c, isModified: true });
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
static loadFromConfig(configDir) {
|
|
40
|
+
const layersPath = join(configDir, "layers.json");
|
|
41
|
+
if (!existsSync(layersPath)) {
|
|
42
|
+
return new _FileClassifier(defaultLayers());
|
|
43
|
+
}
|
|
44
|
+
const config = JSON.parse(readFileSync(layersPath, "utf-8"));
|
|
45
|
+
return new _FileClassifier(config.layers);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
function defaultLayers() {
|
|
49
|
+
return [
|
|
50
|
+
{ name: "domain", paths: ["src/domain/**", "src/core/domain/**"], description: "Business logic, entities, use cases" },
|
|
51
|
+
{ name: "application", paths: ["src/application/**", "src/core/application/**"], description: "Use cases and orchestration" },
|
|
52
|
+
{ name: "infrastructure", paths: ["src/infrastructure/**"], description: "Database, external APIs, low-level I/O" },
|
|
53
|
+
{ name: "api", paths: ["src/api/**", "src/interfaces/**", "src/controllers/**"], description: "HTTP handlers, request/response" },
|
|
54
|
+
{ name: "shared", paths: ["src/shared/**", "src/utils/**", "src/helpers/**"], description: "Utilities, helpers, constants" }
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
FileClassifier,
|
|
59
|
+
defaultLayers
|
|
60
|
+
};
|