kodingo-cli 1.0.36 → 1.0.37

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.
@@ -20,24 +20,24 @@ class CloudEventPort {
20
20
  }
21
21
  async pushDecision(decision, _context) {
22
22
  await this.persistence.initDb();
23
- // Build real priorMemory from existing records for this project
23
+ // Build real priorMemory from affirmed memories in this project
24
24
  let context = _context;
25
25
  try {
26
- const existing = await this.persistence.queryMemoryBySymbol({
27
- symbol: decision.id,
28
- limit: 50,
29
- includeDenied: false,
30
- onlyCanonical: false,
31
- });
32
- const decisions = existing
33
- .filter(r => r.externalId?.startsWith("git:"))
34
- .map(r => r.externalId ?? r.id);
26
+ const repoPath = this.repoPath;
27
+ const records = await this.persistence.queryMemory("", 100, this.repoPath, { includeNonCanonical: false }).catch(() => []);
28
+ const decisions = records
29
+ .filter((r) => r.externalId?.startsWith("git:") || r.id)
30
+ .map((r) => r.externalId ?? r.id)
31
+ .filter(Boolean);
32
+ const mostRecent = records
33
+ .map((r) => new Date(r.updatedAt ?? r.updated_at ?? 0))
34
+ .sort((a, b) => b.getTime() - a.getTime())[0];
35
35
  context = {
36
36
  ..._context,
37
37
  priorMemory: {
38
38
  projectId: decision.projectId,
39
39
  decisions,
40
- updatedAt: existing[0]?.updatedAt ?? new Date(0),
40
+ updatedAt: mostRecent ?? new Date(0),
41
41
  },
42
42
  };
43
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kodingo-cli",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "Kodingo CLI",
5
5
  "license": "MIT",
6
6
  "private": false,